Control Structures vs Control Statements
Summary: Difference Between Control Structures and Control Statements is that when programmers are required to design the logic of a program, they typically use control structures to describe the tasks a program is to perform. A control structure, also known as a construct, depicts the logical order of program instructions. While a Control Statement is a statement that control the execution of other statements. Control Statements tells program to execute statement in a condition or not.
Control Structures
When programmers are required to design the logic of a program, they typically use control structures to describe the tasks a program is to perform. A control structure, also known as a construct, depicts the logical order of program instructions. Three basic control structures are sequence, selection, and repetition.
Sequence Control Structure
A sequence control structure shows one or more actions following each other in order. Actions include inputs, processes, and outputs. All actions must be executed; that is, none can be skipped. Examples of actions are reading a record, calculating averages or totals, and printing totals.
Selection Control Structure
A selection control structure tells the program which action to take, based on a certain condition. Two common types of selection control structures are the if-then-else and the case.
Repetition Control Structure
The repetition control structure enables a program to perform one or more actions repeatedly as long as a certain condition is met. Many programmers refer to this construct as a loop. Two forms of the repetition control structure are the do-while and do-until.
Control Statements
A Control Statement is a statement that control the execution of other statements. Control Statements tells program to execute statement in a condition or not. There are different types of control statements:
if Statement helps program to understand whether statement 1 is going to be executed or statement 2. if statement decides whether to execute another statement.
Loop is a statement that tells program how many times a statement will be executed. Three types of loops are:
- While loop tests whether a condition is true before executing the controlled statement.
- do-while loop tests whether a condition is true after executing the controlled statement.
- for loops are used to execute the controlled statements a number of times given by user.
Switch statement is a statement that decides which statement is going to execute from several statements.
Also Read:
Difference Between Low Level Language and High Level Language
Difference Between Procedural Language and Object Oriented Language
Difference Between Object Oriented Programming and Structured Programming
Difference Between Macros and Functions
Difference Between Low Level Language and Assembly Language
Difference Between Low Level Language and Assembly Language
Difference Between Search Engine and Directory
ncG1vNJzZmiZnq6xqrLFnqmeppOar6bA1p6cp2aTpLpwr86nq6unnGLAtb7UnKuuqpWoere%2FjJymp6yipLluv9Oaq56llaPBtHs%3D