Conditional Statement
if statement
조건에 따라 다른 코드를 실행할 수 있도록 함
if (x < 10) {...}
else {...}
Boolean expression
true or false로 나타내는 표현 -> relation operator or boolean operator로 나타냄
- Relation operator(관계 연산자)
<, >, <=, >=, == , != - Logical operator
&&(and), ||(or), !(not)
Iteration statement
while statement
while (/*condition*/) {
/* loop body */
/* post-processing */ //"후처리" -> 조건을 업데이트 시켜야 함
}
- condition이 true면 loop body 실행 / false면 이어지는 코드 실행
- condition is invariant
for loop
for (data type; condition; post-processing){
/* loop body */
}
