15 lines
220 B
Text
15 lines
220 B
Text
static function fib(steps:Int, handler:Int->Void)
|
|
{
|
|
var current = 0;
|
|
var next = 1;
|
|
|
|
for (i in 1...steps)
|
|
{
|
|
handler(current);
|
|
|
|
var temp = current + next;
|
|
current = next;
|
|
next = temp;
|
|
}
|
|
handler(current);
|
|
}
|