gpt4 book ai didi

c# - 我可以有一个包含多个案例标准的 Switch 语句吗?

转载 作者:行者123 更新时间:2023-11-30 18:48:23 26 4
gpt4 key购买 nike

我可以有这样的 switch 语句吗:

...

switch (temp)
{
case "NW" or "New":
temp = "new stuff"
break;
}

...

最佳答案

不,但你可以使用(至少在 Java 中)

switch (temp) {
case "NW":
case "New":
temp="new stuff";
break;
}

关于c# - 我可以有一个包含多个案例标准的 Switch 语句吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/965480/

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