DEV Community

Discussion on: Explain Recursion Like I'm Five

Collapse
 
dariusx profile image
Darius

Imagine you want to pan-fry some fish, but you have a huge fish and not so large a pan. Write down the steps to cut the fish so it fits in the pan.

Fish-Cutting-Steps:

  1. If the piece of fish fits in your pan, you're done
  2. Otherwise, cut the fish in half
  3. Follow "Fish-Cutting-Steps" for each half