Several points of switch, execution order of for

switch:
1. The key behind the switch supports 6 data types: byte short int char String enumeration
2. There can only be one default at most
3. If the case does not end with break, it will continue as long as the first condition is matched. Execute (regardless of whether the following conditions can be matched), until the break is encountered or to the end

======================================================================================================

for (short while loop):
for (1 initializes conditional statement; 2. Analyzing conditions; 4. cycle control.)
{ 3. The loop body } implementation process: 1st: 1 => 2 => 3 => 4 second 2 times: 2 => 3 => 4 3rd time: 2 => 3 => 4 Last time: 2 eg:









Insert picture description here

================================================= ================
Loop control statements: return, break, continue
1. return: return directly to the calling method
2. break: exit the current loop
3. continue: exit the current loop

Guess you like

Origin blog.csdn.net/ExceptionCoder/article/details/107089400