RosettaCodeData/Task/Short-circuit-evaluation/Smalltalk/short-circuit-evaluation.st
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

21 lines
483 B
Smalltalk

Smalltalk at: #a put: nil.
Smalltalk at: #b put: nil.
a := [:x| 'executing a' displayNl. x].
b := [:x| 'executing b' displayNl. x].
('false and false = %1' %
{ (a value: false) and: [ b value: false ] })
displayNl.
('true or false = %1' %
{ (a value: true) or: [ b value: false ] })
displayNl.
('false or true = %1' %
{ (a value: false) or: [ b value: true ] })
displayNl.
('true and false = %1' %
{ (a value: true) and: [ b value: false ] })
displayNl.