RosettaCodeData/Task/Short-circuit-evaluation/LiveCode/short-circuit-evaluation.livecode

25 lines
693 B
Text
Raw Permalink Normal View History

2018-06-22 20:57:24 +00:00
global outcome
function a bool
put "a called with" && bool & cr after outcome
2016-12-05 23:44:36 +01:00
return bool
2018-06-22 20:57:24 +00:00
end a
2016-12-05 23:44:36 +01:00
function b bool
put "b called with" && bool & cr after outcome
return bool
end b
on mouseUp
2018-06-22 20:57:24 +00:00
local tExp
2016-12-05 23:44:36 +01:00
put empty into outcome
repeat for each item op in "and,or"
repeat for each item x in "true,false"
2018-06-22 20:57:24 +00:00
put merge("a([[x]]) [[op]] b([[x]])") into tExp
put merge(tExp && "is [[" & tExp & "]]") & cr after outcome
put merge("a([[x]]) [[op]] b([[not x]])") into tExp
put merge(tExp && "is [[" & tExp & "]]") & cr after outcome
2016-12-05 23:44:36 +01:00
end repeat
put cr after outcome
end repeat
put outcome
end mouseUp