RosettaCodeData/Task/Short-circuit-evaluation/Smalltalk/short-circuit-evaluation.st
2023-07-01 13:44:08 -04: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.