summaryrefslogtreecommitdiff
path: root/examples/fib.gorth
blob: d044d85e01e94ad974b82a0af7ed223801ffdf10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Print out given number of elements in the Fibonacci sequence, 46 is the max value
define fib
	var lim push lim
	var a 1 push a
	var b 1 push b
	pull lim while dup 0 > do
		pull a dump
		pull b dup
		pull a
		+ push b
		push a
		1 -
	done
end