B4Coder

🪆 Recursion · Mission 1 of 5

🚀 Countdown

A rocket counts down from 5. Instead of a loop, a function says one number, then calls itself with the next one down.

Your mission

  1. Make a Function called countdown, given n.
  2. Inside it: if n == 0, Tell "Liftoff!" and Return. Otherwise Tell n, Call countdown(n - 1), then Return.
  3. From the main program, Call countdown(5). Open Values to watch the call stack.

Getting the mission ready…