Skip to content

15 Control Flow in C++

Control flow statement

1. continue

continue can only be used within loops. If further iterations are possible, it directly proceeds to the next iteration; otherwise, it ends the loop.

2. break

break is primarily used in loops, but it also frequently appears in switch statements, to break out of the loop.

3. return

return completely exits the function.

If your function definition requires returning a value, then a return value must be provided. See 09 Functions

These control flow statements control the execution of the program.

These loops, control flows, and conditional statements (such as if statements) are the essence of logical programming.