Control Level Structure
A control structure is a primary concept in most high-level programming languages. In its simplest sense, it is a block of code. More specifically, control structures are blocks of code that dictate the flow of control. In other words, a control structure is a container for a series of function calls, instructions and statements.
-A control structure is a primary concept in most high-level programming languages. In its simplest sense, it is a block of code. More specifically, control structures are blocks of code that dictate the flow of control. In other words, a control structure is a container for a series of function calls, instructions and statements.
Example:Let us consider the C-style condition if (a == 5) { b = 1 } else { b = 0 };
This is a perfectly acceptable C-style condition. However, the widely accepted coding standard would have us write it as such:
if ( a == 5 ) {
b = 1 }
else {
b = 0
};
There are many other types of control structures than the if then structure. In broad terms, these include the jump or unconditional branch, the conditional branch, the loop, which is essentially a conditional branch, subroutines, co-routines, continuations, and the conditional halt. There are also lower level flow controls, such as interrupts and signals.
The most common specific forms of those control structures are gotos, subroutines, for loops, do while loops, if then, try catch finally, so on and so forth. The names deviate between languages but for the most part these concepts are universal across all imperative programming languages. The concept of the conditional branch, or if then else, exists in C++ as it does in Visual Basic.NET as it does in Ruby.
No comments:
Post a Comment