这是我的代码:
问题在于我希望在while条件中使用
在我的项目中,它首先调用了
while( Func(x) != ERR_D)
{
if(result == ERR_A)
throw...;
if(result == ERR_B)
throw...;
mydata.x = x;
}
问题在于我希望在while条件中使用
result = Func(x)
,因为在while循环内部需要检查结果。while循环应该调用Func(x)
直到返回ERR_D
。
注意,不要使用标签。do{
result = Func(x);
if(result == ERR_A)
throw ...;
if(result == ERR_B)
throw ...;
mydata.x = x;
}while(result != ERR_D);
在我的项目中,它首先调用了
Func(x)
,这不是我想要的。但是我尝试过while(result = Func(x) != ERR_D)
,它不起作用。有什么解决方法吗?
x
从来没有改变过。也许这与此有关?很难说,因为“不起作用”几乎可以意味着任何事情,而我们不知道应该发生什么。 - Ant P