...

/

'goto', but Why?

'goto', but Why?

We'll cover the following...

Where are we going?

⚠️ The following code is meant for Python 2.3.

Press + to interact
from goto import goto, label
for i in range(9):
for j in range(9):
for k in range(9):
print("I am trapped, please rescue!")
if k == 2:
goto .breakout # breaking out from a deeply nested loop
label .breakout
print("Freedom!")

Output

 ...