RosettaCodeData/Task/Fibonacci-sequence/Haxe/fibonacci-sequence-1.hx

16 lines
246 B
Haxe
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
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);
}