RosettaCodeData/Task/Short-circuit-evaluation/Run-BASIC/short-circuit-evaluation.basic

25 lines
474 B
Plaintext

for k = 1 to 2
ao$ = word$("AND,OR",k,",")
print "========= ";ao$;" =============="
for i = 0 to 1
for j = 0 to 1
print "a("; i; ") ";ao$;" b("; j; ")"
res =a(i) 'call always
'print res;"<===="
if ao$ = "AND" and res <> 0 then res = b(j)
if ao$ = "OR" and res = 0 then res = b(j)
next
next
next k
end
function a( t)
print chr$(9);"calls func a"
a = t
end function
function b( t)
print chr$(9);"calls func b"
b = t
end function