if(Conditional expression) {
Processing when the conditional expression is matched;
}else
Processing when the conditional expression does not match;
}
<strong> The process is executed at least once </ strong> because it is evaluated by the conditional expression after it is executed. This is called <strong> post-judgment </ strong> (↔︎ pre-judgment) </ dd>
### * for statement *
<dd> <strong> Specify the number of repetitions and repeat the process </ strong> </ dd>
##### * Basic structure of for statement *
for (① int variable name=initial value;② Variable name<Number of repetitions;③ Repeated processing) { Repeated processing }
<dd> (1) Substitute a variable to record the number of laps of the loop. <Strong> Loop variable </ strong> </ dd>
<dd> ② Conditional expression to determine whether to continue the loop </ dd>
<dd> ③ Process executed after the repeated process is completed (after reaching "}") </ dd>
##### * About loop variables *
<dd> ・ Can be used for calculation and display in blocks </ dd>
<dd> ・ Cannot be used outside the for statement </ dd>
##### * Interruption of iterative processing *
<dd> ・ <strong> break statement </ strong> and <strong> continue statement </ strong> can interrupt the iterative process </ dd>
<dd> Basic syntax of break statement (example: when processing is interrupted at the 5th time) </ dd>
for (int i = 1; i < 10; i++) { if(i==5){ break; } Repeated processing }
<dd> Basic syntax of continue statement (example: when processing only the 5th time) </ dd>
for (int i = 1; i < 10; i++) { if(i==5){ continue; } Repeated processing }
### * switch statement *
<dd> <strong> If there are multiple judgment conditions, it can be described completely from if <strong> </ dd>
##### * Terms of use for switch statements *
<dd> ・ It must be a condition to compare whether the left and right match. </ Dd>
<dd> -The value to be compared is not a decimal or boolean value </ dd>
##### * Basic syntax of switch statement *
switch(Variable name) { case value 1: Processing when the variable matches the value 1 break; /*End the process with break case value 2: Processing when the variable matches the value 2 break; default : Processing when variables do not match all values }
## Control syntax components
ʻIf (conditional expression) {`
<strong> block </ strong>
`}`
#### * Characteristics of conditional expressions *
<dd> -The conditional expression must have an evaluation result of `true` or` false` </ dd>
#### * When using a character string in a conditional expression ... *
<dd> ・ `.equals ("string ")` </ dd> instead of `= ("string ")`
#### * Block features *
<dd> -Variables declared within a block are valid only within the declared block </ dd>
<dd> -The range of places where variables can be used is called ** scope ** </ dd>
## Relational operator
<dd> Symbols used in conditional expressions </ dd>
|operator|meaning|
|:-----------|--------:|
| == |Left side and right side are equal|
| != |The left side and the right side are different|
| > |Left side is less than right side|
| < |The left side is more than the right side|
| >= |The left side is more than the right side|
| <= |The left side is below the right side|
## Logical operator
|operator|meaning|
|:----------|--------:|
|&& |AND|
|ll |OR (or)|
## Negation operator
<dd> ・ Before the conditional expression! By adding, the value of the conditional expression, true / false, can be reversed. </ Dd>
###### ʻIf (! (name.equals ("a"))) `→ name = a <strong> unless </ strong>