当前位置:网站首页>Why is the default of switch followed by break?
Why is the default of switch followed by break?
2022-07-02 13:23:00 【Weak foundation, earth shaking and mountains shaking】
At first, many people thought it was 5 In fact, the result is 7.
reason : because switch Meet again The matching condition is that it will always be executed downward by default , So in matching default The condition in will be executed downward case 1 and case 2 Conditions in .
As shown in the figure below default After matching, the following two conditions will be executed, resulting in b=4.
And in the case 1: Add break And then it's like this , It's only going to be executed once b++, As shown in the figure below .
And in the defaul Followed by break after b It's not going to happen ++ 了 , As shown in the figure below .
If the foundation is not strong, the earth will shake and the mountains will shake !
边栏推荐
- 【OpenGL】笔记二十九、高级光照(镜面高光)
- Jerry's watch reads the alarm clock [chapter]
- linux下清理系统缓存并释放内存
- What are eNB, EPC and PGW?
- Essential for operation and maintenance - Elk log analysis system
- Jerry's weather code table [chapter]
- 科技的成就(二十七)
- West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials
- JS逆向之巨量创意signature签名
- 为什么switch 的default后面要跟break?
猜你喜欢
Redis数据库持久化
OpenApi-Generator:简化RESTful API开发流程
MAC (MacOS Monterey 12.2 M1) personal use PHP development
二、帧模式 MPLS 操作
日本赌国运:Web3.0 ,反正也不是第一次失败了!
Unity skframework framework (XII), score scoring module
阿里初面被两道编程题给干掉,再次内推终上岸(已拿电子offer)
Jerry's watch modifies the alarm clock [chapter]
The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner
挥发性有机物TVOC、VOC、VOCS气体检测+解决方案
随机推荐
Can automatically update the universal weekly report template, you can use it with your hand!
Unity skframework framework (XII), score scoring module
SSL证书的分类有哪些?如何选择合适的SSL证书?
Mysql常用命令详细大全
D为何链接不了dll
Fundamentals of face recognition (facenet)
Redis数据库持久化
The redis development document released by Alibaba covers all redis operations
Unity skframework framework (XIII), question module
Numpy array calculation
Node.js通过ODBC访问PostgreSQL数据库
Explanation of 34 common terms on the Internet
What are eNB, EPC and PGW?
Jerry's weather direction coding table [chapter]
OLED screen driver based on stm32
Should I have a separate interface assembly- Should I have a separate assembly for interfaces?
[opencv learning] [Canny edge detection]
科技的成就(二十七)
研究表明“气味相投”更易成为朋友
Tupang multi-target tracking! BOT sort: robust correlated multi pedestrian tracking