RosettaCodeData/Task/Short-circuit-evaluation/Liberty-BASIC/short-circuit-evaluation.basic
2023-07-01 13:44:08 -04:00

35 lines
705 B
Text

print "AND"
for i = 0 to 1
for j = 0 to 1
print "a("; i; ") AND b( "; j; ")"
res =a( i) 'call always
if res <>0 then 'short circuit if 0
res = b( j)
end if
print "=>",res
next
next
print "---------------------------------"
print "OR"
for i = 0 to 1
for j = 0 to 1
print "a("; i; ") OR b("; j; ")"
res =a( i) 'call always
if res = 0 then 'short circuit if <>0
res = b( j)
end if
print "=>", res
next
next
'----------------------------------------
function a( t)
print ,"calls func a"
a = t
end function
function b( t)
print ,"calls func b"
b = t
end function