gpt4 book ai didi

c# - 从变量更改 if 语句

转载 作者:太空宇宙 更新时间:2023-11-03 18:27:37 24 4
gpt4 key购买 nike

<分区>

不确定问题是否正确,但这是我正在努力完成的。

我正在运行一个 for 循环,我想在其中更改每个循环中的 if 语句。

例子如下:

for(int i=0;i<3;i++){

int currentField = field;

var context1=currentField;
int curprogr=0;

switch (i){
case 0:
context1 = currentField % 10 != 0;
curprogr = 1;
break;
case 1:
context1 = Mathf.Floor(currentField/10) != 0;
curprogr = 10;
break;
case 2:
context1 = currentField % 10 != 0 && Mathf.Floor(currentField/10) != 0;
curprogr = 11;
break;
}

while(context1){ // Here is where I want it to chnage for each time the loop runs through //
// Some logic here... //
}
}

我收到此错误:无法在与上下文 1 有关的每个开关盒中将类型 bool' 隐式转换为 int'。

希望这是有道理的,我们将不胜感激。

提前致谢

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com