【发布时间】:2012-09-30 23:21:17
【问题描述】:
我的代码如下:
done = False
def function():
for loop:
code
if not comply:
done = True #let's say that the code enters this if-statement
while done == False:
function()
由于某种原因,当我的代码进入 if 语句时,它在使用 function() 完成后并没有退出 while 循环。
但是,如果我这样编码:
done = False
while done == False:
for loop:
code
if not comply:
done = True #let's say that the code enters this if-statement
...它退出while循环。这是怎么回事?
我确保我的代码进入了 if 语句。我还没有运行调试器,因为我的代码有很多循环(相当大的二维数组),我放弃了调试,因为它太乏味了。为什么“完成”在函数中没有被更改?
【问题讨论】: