Skip to content

Instantly share code, notes, and snippets.

@codingdesigner
Created August 5, 2011 22:13
Show Gist options
  • Save codingdesigner/1128650 to your computer and use it in GitHub Desktop.
Save codingdesigner/1128650 to your computer and use it in GitHub Desktop.
generates fibonnaci sequence up to a number
// generate fibonacci numbers
// fib(50) #=> 1 1 2 3 5 8 13 21 34
@function fib($n)
$fibonacci: ()
$i: 0
$j: 1
@while ($i + $j) < $n
$fibonacci: append($fibonacci, $i + $j)
$k: $j
$j: $i
$i: $i + $k
@return $fibonacci
@debug fib(50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment