Rekursion uppstår när någonting definieras i termer av sig själv.
Dagens rekursion
procedure RecursiveBottlesOfBeer. (n: number of bottles)
If n = 0:
Sing: “No bottles of beer on the wall, no bottles of beer,”
Sing: “Go to the store, buy some more, n bottles of beer on the wall.”
Else:
Sing: “n bottles of beer on the wall, n bottles of beer,”
Sing: “Take one down, pass it around, n − 1 bottles of beer on the wall.”
RecursiveBottlesOfBeer (n-1)