Fibonacci numbers in REXX

Example for versions REXX

This example uses recursive definition of Fibonacci numbers.

 1  #!/usr/bin/rexx
 2  /* Calculate Fibonacci using recursion */
 3
 4    numbers = ''
 5
 6    do n = 1 to 16
 7      numbers = numbers fibonacci(n)","
 8    end
 9
10    say numbers"..."
11  exit
12
13  fibonacci: procedure
14    parse arg n .
15
16    if n < 3 then
17      n = 1
18
19    else
20      n = fibonacci(n-1) + fibonacci(n-2)
21  return n