Fibonacci in Moonscript

Published on 17 February 2025 (Updated: 17 February 2025)

Welcome to the Fibonacci in Moonscript page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

-- fibonacci function
fibonacci = (n) ->
    -- set up a, b, for i until n, print "i: n" then update a & b as the fibonacci sequence
    a, b = 1, 1
    for i = 1, n
        print "#{i}: #{a}"
        a, b = b, a + b

-- main
-- check if arg params are numbers and are greater than 0
if arg[1] and tonumber(arg[1]) ~= nil and tonumber(arg[1]) >= 0
    fibonacci tonumber(arg[1])
-- else, return usage error msg
else   
    print "Usage: please input the count of fibonacci numbers to output"
    

Fibonacci in Moonscript was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.