Flow of Control
In a program, the statements may get executed
Sequentially
Selectively (Decision construct)
Iteratively (Looping construct)
Selection Statements
Dangling else
In nested if, the dangling else statement matches with the preceding unmatched if statement.
if (condition 1)
if (condition 2)
// Something
else
// Something
This will be interpreted as the following, by compiler
if (condition 1)
if (condition 2)
// Something
else
// Something
Switch case
We cannot use floating point comparisons.
Switch cases are faster than if else ladder.
We can write the default anywhere inside the switch block.
Iteration Statements
forloopwhileloopdo whileloop
Jump Statements
breakImmediately exits the closest enclosing loop or
switch.
continueSkips the remaining code in the current iteration
Jumps to the next iteration
Works only in loops
gotoWorks inside the same function
It Uses labels
label:
// code
goto label;
returnExits the function immediately
Optionally returns a value
Last modified: 08 February 2026