当前位置:网站首页>Process control statement
Process control statement
2022-07-27 16:48:00 【.Null】
Flow control statement
Summary of knowledge points : Flow control statement
One . if...else Statements can be seen as having 4 In the form of :
1) if sentence
if( Boolean expression ){ If the Boolean expression is true Statement to be executed }
2) if...else sentence
if( Boolean expression ){ If the value of a Boolean expression is true} else{ If the value of a Boolean expression is false}
3) if...else if...else sentence
Format : if( Boolean expression 1){ If the Boolean expression 1 The value of is true Execute code }
else if( Boolean expression 2){ If the Boolean expression 2 The value of is true Execute code }
else if( Boolean expression 3){ If the Boolean expression 3 The value of is true Execute code }
else { If none of the above Boolean expressions are true Execute code }
Two . Nested if…else sentence
Format : if( Boolean expression 1){ If the Boolean expression 1 The value of is true Execute code
if( Boolean expression 2){ If the Boolean expression 2 The value of is true Execute code }}
3、 ... and .switch sentence
switch case Sentences have the following rules :
1)switch The variable type in a statement can be : byte、short、int perhaps char、enum. from Java SE 7 Start ,
switch Support string String Type , meanwhile case Label must be a string constant or literal .
2)switch Statements can have more than one case sentence . Every case Followed by a value and colon to compare .
3)case The data type of the value in the statement must be the same as the data type of the variable , And it can only be a constant or literal constant .
4) When the value of a variable is equal to case When the values of the statements are equal , that case Statement after statement begins execution , until break The sentence will jump out switch sentence .
5) When you meet break When the sentence is ,switch Statement termination . The program jumps to switch Statement execution after statement .case The statement does not have to contain break sentence . without break The statement appears , The program will continue with the next case sentence , Until it appears break sentence .
6)switch A statement can contain a default Branch , This branch is usually switch The last branch of the statement ( Can be anywhere , But usually in the last ).default In the absence of case Execute when the value of a statement is equal to the value of a variable .default Branches don't need break sentence . switch( expression ) {
case Expression value 1: Sentence block 1;
break;
case expression N: Sentence block N;
break;default: Sentence block ;}
边栏推荐
猜你喜欢

Collection! 0 basic open source data visualization platform flyfish large screen development guide

Opencv (IV) -- image features and target detection

雪花ID(Go 实现)

OpenCV(一)——图像基础知识

Cron expression use

Quadratic programming based on osqp
Interpretation of C basic syntax: summarize some commonly used but easily confused functions (i++ and ++i) in the program (bit field)

(二)动态卷积之Dynamic Convolution
![[paper reading] transformer with transfer CNN for remote sensing imageobject detection](/img/a2/8ee85e81133326afd86648d9594216.png)
[paper reading] transformer with transfer CNN for remote sensing imageobject detection

Automatic classification of e-commerce UGC pictures using Baidu PaddlePaddle easydl
随机推荐
[paper reading] a CNN transformer hybrid approach for cropclassification using multitemporalmultisensor images
KMEANS 实现
2021-06-02
Simulation生成报表
kubesphere多节点安装出错
SolidWorks simulation curve attribute setting
Notes on implementation and acquisition of flowable custom attributes
Json数据的格式使用
使用百度飞桨EasyDL实现电商UGC图片自动分类
Const summary
Cubemx联合IAR工程移植
D3.js create a cool arc
CCF-201312-1
Two methods of generating excel table with PHP
Crawl common English names
training on multiple GPUs pytorch
Apache
Array analog linked list
OpenCV(二)——图像基本处理
TP5 query empty two cases