07Chapter 流程控制2019-11-10
流程控制
程序执行过程中,各条语句的执行顺序对程序的结果是有直接影响的. 即程序的流程对运行结果有直接影响. 流程控制主要有三种
1.顺序结构
2.判断语句
第一种if
Notice: The type that can be put in parentheses
-- Basic data type(byte short int char)
-- Reference data type(String enum)
-- The order can be changed at will without affecting the result, even if "default" is modified
3.循环语句
A loop statement can execute a piece of code repeatedly until the loop condition is not satisfied.
The four components of a cyclic structure
one:The initialization statement is initially executed at the beginning of the loop and is executed only once
tow:Conditional judgment, used to determine whether the cycle continues or not
three:Looping body, several pieces of code that need to be executed repeatedly
four:Step statement, the code that needs to be done at the end of each loop