🪆 Recursion · Mission 4 of 5
⚡ Power Up
2 to the power 10 is 2 × 2 × … ten times. Or: 2 × (2 to the power 9). A function with two values can call itself too.
Your mission
- Make a Function powerOf, given base, times. If times == 0, Return 1. Otherwise Call powerOf(base, times - 1) into smaller, and Return base * smaller.
- Main: Ask for the base and how many times, Call powerOf(base, times) into answer, and Tell "Answer: " + answer.
Getting the mission ready…