RosettaCodeData/Task/Fibonacci-sequence/AutoHotkey/fibonacci-sequence-1.ahk

19 lines
205 B
AutoHotkey
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
Loop, 5
MsgBox % fib(A_Index)
Return
fib(n)
{
If (n < 2)
Return n
i := last := this := 1
While (i <= n)
{
new := last + this
last := this
this := new
i++
}
Return this
}