– Blocks combine multiple statements into a single unit.
– Can be used when a single statement is expected.
– Creates a local scope (variables declared inside are local to the block).
– Blocks can be nested.
Conditional blocks
– if ... else..else if is used for conditional branching of execution
– is used to test multiple conditions (more efficient than if else ladders).
Iterative blocks
– while loop tests condition before execution of the block.
– do..while loop tests condition after execution of the block.
– for loop provides initialization, testing and iteration together.
이전페이지 / 5 /