当前位置:网站首页>Judgment statement _switch and case
Judgment statement _switch and case
2022-08-05 05:03:00 【good girl @@@】
[1]Syntax
The value following theswitch can be either a value or an expression, but only a value can follow the case!
switch (value/expression){case value1:statements1 // When the result of the expression/value equals value1, execute the codebreak;case value2:statements2 // When the result of the expression/value equals value2, execute the codebreak;......case valueN:statementsN // When the result of the expression/value equals valueN, execute the codebreak;default :statements // If there is no value equal to the expression/value, execute the code}
[2]Comparison process
The switch statement compares the value of the expression with the value in the case clause in turn:
- If the two are equal, execute the following statement segment, and jump out of the entire switch statement when the break keyword is encountered.
- If not equal, continue to match the next case.
- The switch statement contains an optional default keyword, if no equal condition is found in the previous case, the statement following the default is executed
- The comparison process is
congruent
!
边栏推荐
猜你喜欢
随机推荐
雷克萨斯lm的安全性到底体现在哪里?一起来看看吧
[Geek Challenge 2019]FinalSQL
【informix】解决启动报错大全,以及解决办法
Qt制作18帧丘比特表白意中人、是你的丘比特嘛!!!
After controlling the export file in MySQL, it becomes \N. Is there any solution?
Application status of digital twin technology in power system
Cryptography Series: PEM and PKCS7, PKCS8, PKCS12
Use IDEA to connect to TDengine server
C++ core programming
The solution to the failure to read channel information when dedecms generates a message in the background
What is ASEMI photovoltaic diode, the role of photovoltaic diode
mutillidae download and installation
dedecms报错The each() function is deprecated
Flutter 父子组件如何都能收到点击事件
dedecms织梦tag标签不支持大写字母修复
延迟加载js方式async与defer区别
Day019 方法重写与相关类的介绍
说说数据治理中常见的20个问题
Learning and finishing of probability theory 8: Geometric and hypergeometric distributions
[8.3] Code Source - [meow ~ meow ~ meow~] [tree] [and]