I. Exercises for the loop structure while statement
Note: While statements are written in the same way as the IF Format 1, the only difference is that the keyword is different from the beginning. In the video explanation, the criterion of the two conditional statements is the same, the final output is the Boolean type of data.
What we want to explore now is what constitutes the conditional expression in the IF statement of the structure, the switch statement that chooses the structure, and the loop structure in the while statement?
We know that the final output in the conditional expression of the IF statement is a Boolean type of data, but the composition of the expression is in several forms, with the assignment operator participating (if x==3) and the interval form (the composition of the interval is also a comparison operator and a logical operator). There can also be direct Boolean data.
The IF condition statement is directly false, showing that the program has no action on the IF statement. Without judgment, of course, the IF statement is not executed.
The conditional expression of switch is numeric, which shows the difference from If,while. The switch conditional expression finally gets a numeric data, and If,while gets a Boolean type of data that may be expressed in the same form but with different results (?). ),
Java-preliminary Understanding-Chapter III-Exercise of the cyclic structure 2