summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/rouge-4.5.2/lib/rouge/demos/mojo
blob: dacbefa104a9eecd10bdf903fceafd3f5db940d0 (plain)
1
2
3
4
5
6
7
8
9
10
fn fib(n: Int): # write Fibonacci series up to n
    """Print a Fibonacci series up to n."""
    var a = 0
    var b = 1
    while a < n:
        print(a)
        a, b = b, a+b

fn main():
    fib(10)