What are control statements? (2024)

In general, control statements help with the control flow of the program. But, do we mean by control flow?

Control flow is the order in which the statements execute.For example, the program’s flow is usually from top to bottom(Sequential flow), but what if we want a particular block of code to only be executed when it fulfills a specific condition or wants to run a block of the code a specified number of times? These statements will ensure a smooth and intentional flow of a program.

There are three types of control statements:

  1. Conditional/Selection statements
  2. Iteration/Loop statements
  3. Jump statements

Conditional/selection statements

These control statements help with implementing decision-making in a program.A conditional statement will select the block of statements that will execute based on the given condition. The result of the program depends on the condition.

If the condition provided proves to be true, the result is 1; if it proves to be false, the result is 0. When there is a truth value, the code will get executed; otherwise, it will not.

What are control statements? (2024)
Top Articles
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 6249

Rating: 4.7 / 5 (67 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.