A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
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.
-- 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.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.