Category:Smalltalk: Difference between revisions

Line 402:
False
ifYouAreTrueThenDo: arg1 ifNotThenDo: arg2
^ arg2 value</lang>
Now, we can send this message to a boolean, and pass the code to be executed conditionally as a lambda block:
<lang smalltalk>(a > 0) ifYouAreTrueThenDo:[ 'positive'printCR ] ifNotThenDo:[ 'negative' printCR ]</lang>
Anonymous user