nimp/examples/fibonacci.nimp

15 lines
432 B
Plaintext
Raw Normal View History

define fibonacci as function
taking n as integer
and returning integer
with body {
if n is less than or equal to 1 then return n.
return sum of
call fibonacci with n as difference of n and 1, and
call fibonacci with n as difference of n and 2.
}.
define x as integer with value of call fibonacci with n as 42.
import module io from standard-library.
call io:print with contents as string of x.