krunal shah
krunal shah

Reputation: 16339

What's the difference between these conditions?

Is there any specific difference between these conditions?

1) 
   begin
     acct = 1
     return 0
   end unless self.l_acct.nil?

2)
   unless self.l_acct.nil? 
     acct = 1
     return 0
   end    

Upvotes: 1

Views: 92

Answers (1)

Johannes Gorset
Johannes Gorset

Reputation: 8785

Yes; the former is bad practice, the latter is not. They both accomplish the same thing.

Upvotes: 2

Related Questions