Failed Attempt: Shadowing
Let’s try to use the tools we already have in our toolbox to make a while
loop that exits. We’ll create a variable, keep_going
. It will start off as true
, and then we’ll make the variable equal to false
inside the body of the while
using name shadowing. As a reminder, name shadowing lets us create a new variable with the same name as the one before, e.g.:
Get hands-on with 1400+ tech skills courses.