Lesson summary

2.4 Language selection structure
if conditional statement
if (condition statement) {

代码块 

}

if........else语句

if (determination condition) {
execute statement. 1
} {the else
executing statements 2

}

if........else,if........else语句

if (determination condition) {
execute statement. 1
} the else if (judgment condition 2) {
execute statement 2

}
.
.
.
else if (condition determination n) {
execute statement n + 1

}

switch conditional statements

switch (expression) {
Case 1 target:
execute statement 1
BREAK;
Case target 2:
execute statement 2
BREAK;
·
·
·
Case target n:
execute statement n-
BREAK;
default: * No compliance
executing statements n + 1
BREAK;
}

Guess you like

Origin blog.51cto.com/14589602/2449276