Guest User

Untitled

a guest
Feb 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. z = condition.ifTrue { 1 + 1 }.ifFalse { 0 } # How?
  2. # If the result is the body of the block the ifFalse could be accidently run by
  3. true.ifTrue { false }.ifFalse { puts "False!" }
  4. # if the result is _not_ the body of the block but rather the condition, it's not an expression
  5. # anymore but a procedural control structure and you have to write
  6. condition.ifTrue { z = 1 + 1 }.ifFalse { z = 0 }
  7. # which is ok I suppose, but not how smalltalk works
Add Comment
Please, Sign In to add comment