aboutsummaryrefslogtreecommitdiff
path: root/examples/fib.stem
blob: de02b5cffbd64f857a73bdfa0542a0f0cf1b1ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Author: Andrei Sova 2023
fib [
  dup 1 <= [ ] [
    dup 1 - fib
    swap
    dup 2 - fib
    swap
    dsc
    +
  ] if
] func

main [
  dup 10 <= [
    dup fib .
    1 + main
  ] [ exit ] if
] func

0 main