Cool but using if is way faster.
if bSwitch > 0 : bSwitch = 0 : else bSwitch = 1 : endif
Appx 6.5 times faster here.
t = 0
begtime# = timer()
for i = 1 to 10000000
t = swap(t)
next i
total# = timer()-begtime#
cls
print total#
wait key
begtime# = timer()
for i = 1 to 10000000
t = swap2(t)
next i
total# = timer()-begtime#
cls
print total#
wait key
function swap(bSwitch)
if bSwitch > 0 : bSwitch = 0 : else bSwitch = 1 : endif
endfunction bSwitch
function swap2(bSwitch)
bSwitch = 180 / (wrapvalue(bSwitch * 180) + 180)
endfunction bSwitch