'
' Recursive factorial function test
'

pr.dec fact(5); 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

