We need to be sure our Camp function calls the Fire value’s Extinguish method before the program exits. But right now, Camp is returning early due to an error, before Extinguish can be called.
We don’t want to leave a lit Fire unattended in the forest! Revise the Camp function so that Extinguish is always called, even if Camp returns early.
Solution
Output:
Fire lit: true
Fire lit: false
Error: spotted a bear