Control Statement

 

INTRODUCTION

 

  1. Sequential control structure
  2. Selective control structure
  3. Iterative control structure

 

Sequential Control Structure

 

The normal flow of control of all programs is sequential. In sequential structure, a sequence of programs statements are executed one after another in the order in which they are placed. Both selection and repetition statements allows allow the programmer to alter the normal sequential flow of control.

 

Sequential programming can also be called linear programming. The sequential programs are non-modular in nature. That is, reusability of code is not possible. Thus, they are difficult to maintain and understand. Examples of sequence control structure statements are, the program will have statements that are placed sequentially and there is no decision involved in the process. Also, the program does not require a specific task to be repeated over and over again.

 

Selective Control Structure (or) Decision Control Structure

 

The selective structure allows the usual sequential order of execution to be modified. It consists of a test for a condition followed by alternative paths that the program can follow. The program selects one of the alternative paths depending upon the result of the test for condition. Examples of selective control structures statements are :

 

  1. Simple if statement
  2. if . . . else statement
  3. Nested if . . . else statement
  4. else if ladder
  5. switch . . . case . . .default statement

 

Iterative Control Structure (or) Loop Control Structure

 

The iterative structure provides the ability to go back and repeat a set of statements. Iterative structure is otherwise referred to as repetitive structure. Examples of iterative control structure statements are :

 

  1. while statement
  2. do . . . while statement
  3. for statement

 

 

 

 

 

 

 

Registration


A password will be e-mailed to you.

Feedback Form

Name (required)

Email (required)

Feedback