Skip to main content

Need of control statements

Short answer

Control statements alter the sequential flow of execution: decision (if, switch), loop (for, while, do‑while), and jump (break, continue, etc.). They are needed to make decisions, repeat code, and handle different cases, without which programs could only follow a single fixed path.

Why do we need control statements in computer programs? What are control statements?

Control statements are statements that control the order in which other statements of a program are executed. By default, C runs statements one after another (sequentially). Control statements change this flow.

Types:

  • Decision (selection): if, if-else, else-if ladder, switch
  • Loop (iteration): for, while, do-while
  • Jump: break, continue, goto, return

We need them to:

  • take decisions according to conditions (is the number even? are the marks enough to pass?);
  • repeat a block of statements many times without rewriting it;
  • skip or terminate parts of a program, and so solve real problems with different cases.

Without them, a program could only run in a fixed straight line.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Programming chapter 5 questions →