[squeak-dev] Having fun with booleans

Igor Stasenko siguctua at gmail.com
Fri Mar 5 07:22:03 UTC 2010


Hello,
I just realized, that one can completely avoid using ifTrue/ifFalse
branches, but use #or: and #and: instead.

a > b ifTrue: [ ... ]
could be written as:
a > b and: [ ... ]

a > b ifFalse: [ ... ]
could be written as:
a > b or: [ ... ]

and
a > b ifTrue: [ self foo ] ifFalse: [ self bar ]
could be written as:

a > b and: [ self foo]; or:[ self bar ]

:)

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list