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

25 lines
693 B
Plaintext

global outcome
function a bool
put "a called with" && bool & cr after outcome
return bool
end a
function b bool
put "b called with" && bool & cr after outcome
return bool
end b
on mouseUp
local tExp
put empty into outcome
repeat for each item op in "and,or"
repeat for each item x in "true,false"
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
end repeat
put cr after outcome
end repeat
put outcome
end mouseUp