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

26 lines
836 B
Text

define('a(val)') :(a_end)
a out = 'A '
eq(val,1) :s(return)f(freturn)
a_end
define('b(val)') :(b_end)
b out = 'B '
eq(val,1) :s(return)f(freturn)
b_end
* # Test and display
&fullscan = 1
output(.out,1,'-[-r1]') ;* Macro Spitbol
* output(.out,1,'B','-') ;* CSnobol
define('nl()'):(nlx);nl output = :(return);nlx
out = 'T and T: '; null ? *a(1) *b(1); nl()
out = 'T and F: '; null ? *a(1) *b(0); nl()
out = 'F and T: '; null ? *a(0) *b(1); nl()
out = 'F and F: '; null ? *a(0) *b(0); nl()
output =
out = 'T or T: '; null ? *a(1) | *b(1); nl()
out = 'T or F: '; null ? *a(1) | *b(0); nl()
out = 'F or T: '; null ? *a(0) | *b(1); nl()
out = 'F or F: '; null ? *a(0) | *b(0); nl()
end