main.m120 chars8 lines
This is a simple recursive implementation of the fibonacci sequence. To output the nth term, you can simply call the function with the desired value of n
and store the result in a variable. For example, to output the 8th term:
main.m42 chars4 lines
The output will be 21
, which is the 8th term in the fibonacci sequence.
Alternatively, you can use a loop to calculate the sequence up to the nth term without recursion:
main.m138 chars9 lines
This will give the same output as the previous example.
gistlibby LogSnag