我在永IDE運行蟒蛇2.75(CLOSED)賦值之前引用的局部變量'exit'?
代碼:
exit = False
while not exit:
selection = int(raw_input("Press 1 to go and 0 to quit: ")
if selection == 1:
print("yay")
elif selection == 0:
print("Goodbye")
exit = True
else:
print("Go away")
當我按下0,它說:
local variable 'exit' referenced before assignment
什麼是錯的?
OK,沒有他們arent對不起,錯字http://stackoverflow.com/questions/的 – user3595018
重複9264763/unboundlocalerror合蟒。 – Veedrac