summaryrefslogtreecommitdiff
path: root/nc_files/factorial.ngc
blob: 255f57527abcc23ae0891d3fe1f55e64817ad3b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
; recursive function example
; factorial
o<factorial> sub
o<factorialif> if [[#1] EQ 0]
o<factorial> 	  return [1]
o<factorialif> else
o<factorial>      call [[#1] - 1]
o<factorial>      return  [#<_value> * #1]
o<factorialif> endif
o<factorial> endsub
m2