EightBall/fact.8b
Bobbi Webber-Manners d9532c8f71
v0.62: Fixed function call bug in compiled code
- The compiler was not pushing the SENTINEL value to the operator stack and popping it afterwards, so the expression parsing was getting messed up.  Now fixed.
- Also added targets to the Makefile to allow the emulators to be run directly (make xvic, make x64, make mame).
2018-05-04 00:02:16 -04:00

18 lines
293 B
Plaintext

'
' Recursive factorial function test
'
pr.dec fact(3); pr.nl
end
sub fact(word val)
pr.msg "fact("; pr.dec val; pr.msg ")"; pr.nl
if val == 0
return 1
else
return val * fact(val-1) ; ' THIS DOES NOT WORK
' return fact(val-1) * val ; ' BUT THIS DOES!!!
endif
endsub