开关盒中的错误 [英] error in switch case

查看:93
本文介绍了开关盒中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


hi when i write following command:

switch (myparam)
			{
				
				case "p1":
					this.Close();
					break;
				case "p2":
					break;
				case "p3": 
					if (mytag)
					{
						return;
					}
					myprocc1();
					
                    
			}





编译后显示此错误

错误5控件无法从一个案例标签('casep3:')转到另一个案例标签





谢谢



this error be shown after compile
Error 5 Control cannot fall through from one case label ('case "p3":') to another


thanks

推荐答案

您只是忘了将中断添加到案例p3。因此,执行将落在下一个案例中。要纠正这种情况,请添加休息时间。比如

You have simply forgot to add the break into the end of the case "p3". Because of that the execution would fall the the next case. To correct the situation add the break. Like
switch (myparam)
{
   case "p1":
      this.Close();
      break;
   case "p2":
      break;
   case "p3":
      if (mytag)
      {
         return;
      }
      myprocc1();
      break; 
}



但总体而言,我同意您应首先检查文档中是否存在问题。通过这种方式,您可以全面了解语言:)


But in overall, I agree that you should first check the documentation for the statements you have problem with. This way you get to know the language in overall :)


Dude,您是否打算阅读一些书籍,学习一些教程,使用intellisense,阅读编译器消息...或者其他内容你自己?你正陷入基本的语法错误......一个接一个......



停止发布你做的每一个小错误,并至少使用谷歌!



开始这里 [ ^ ]例如,你不回来直到你完成它...
Dude, do you intend to read some book, take some tutorial, use intellisense, read the compiler messages... or something on your own? You are falling into basic syntactical errors... one after an other...

Stop posting on every little mistake you do, and use google at least!

Start HERE[^] for example, and don't you come back until you have finisged it...


这篇关于开关盒中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆