forked from nat/natalieee.net
add blog posts: dollcode, python-goto
This commit is contained in:
49
www/src/data/thoughts/python-goto/limitations.py
Normal file
49
www/src/data/thoughts/python-goto/limitations.py
Normal file
@ -0,0 +1,49 @@
|
||||
from goto_label import *
|
||||
|
||||
gaurd = 0
|
||||
|
||||
#LABEL say_hi
|
||||
print('hi')
|
||||
|
||||
#LABEL loop_start
|
||||
gaurd += 1
|
||||
|
||||
if gaurd > 2: goto &call_b
|
||||
|
||||
def a():
|
||||
global gaurd
|
||||
goto &a_skip
|
||||
#LABEL a_label
|
||||
print('inside a_label')
|
||||
goto &loop_start
|
||||
if gaurd:
|
||||
return
|
||||
#LABEL a_skip
|
||||
print('a')
|
||||
if gaurd < 2:
|
||||
goto &say_hi
|
||||
goto &a_label
|
||||
...
|
||||
|
||||
def b():
|
||||
global gaurd
|
||||
goto &b_skip
|
||||
#LABEL b_label
|
||||
print('inside b_label')
|
||||
goto &say_hi
|
||||
goto &a_label
|
||||
if gaurd > 2:
|
||||
return
|
||||
#LABEL b_skip
|
||||
print('b')
|
||||
goto &a_label
|
||||
a()
|
||||
goto &b_label
|
||||
...
|
||||
|
||||
a()
|
||||
print('done with a()')
|
||||
goto &say_hi
|
||||
...
|
||||
#LABEL call_b
|
||||
b()
|
Reference in New Issue
Block a user