RockstarLang / rockstar

Home of the Rockstar programming language
https://codewithrockstar.com/
GNU Affero General Public License v3.0
6.88k stars 223 forks source link

Add recursive implementation of nth fibonacci #315

Closed GPLeemrijse closed 2 years ago

GPLeemrijse commented 2 years ago

A very heavy metal showcase of Rockstar's recursion capabilities.

The classic recursive fibonacci definition:

fib(n):
    if(n <= 1):
        return n;
    return fib(n-1) + fib(n-2);

The reason for including this as an example is because as far as I can tell no other examples make use of recursion.