当前位置:网站首页>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
!
边栏推荐
猜你喜欢
Machine Learning Overview
In the hot summer, teach you to use Xiaomi smart home accessories + Raspberry Pi 4 to connect to Apple HomeKit
Mini Program_Dynamic setting of tabBar theme skin
University Physics---Particle Kinematics
【学生毕业设计】基于web学生信息管理系统网站的设计与实现(13个页面)
jvm 三 之堆与栈
The role of DataContext in WPF
[MRCTF2020] Ezpop (detailed)
span标签和p标签的区别
Flutter学习2-dart学习
随机推荐
开发属于自己的node包
Is the NPDP certificate high in gold content?Compared to PMP?
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
The role of DataContext in WPF
【微信小程序】WXML模板语法-条件渲染
Flutter TapGestureRecognizer 如何工作
1007 Climb Stairs (greedy | C thinking)
[cesium] 3D Tileset model is loaded and associated with the model tree
jvm 三 之堆与栈
虚证、实证如何鉴别?
Flutter学习2-dart学习
JeeSite New Report
Use IDEA to connect to TDengine server
write the story about us
【无标题】
for..in和for..of的区别
判断语句_switch与case
dedecms后台生成提示读取频道信息失败的解决方法
LeetCode:1403. 非递增顺序的最小子序列【贪心】
[cesium] element highlighting