virt2/assets/vendor_plugins/ace-builds-master/demo/kitchen-sink/docs/io.io

6 lines
140 B
Io
Raw Permalink Normal View History

// computes factorial of a number
factorial := method(n,
if(n == 0, return 1)
res := 1
Range 1 to(n) foreach(i, res = res * i)
)