tags:

views:

56

answers:

1

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    
+2  A: 

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

Johannes Gorset
Bad practice because it's harder to read?
Andrew Grimm
@Andrew Grimm: Yes, exactly.
Johannes Gorset