Showing posts with label if. Show all posts
Showing posts with label if. Show all posts

C# - Control Statements


Control flow and program logic are of the most important parts of a programming language’s dynamic behavior. In this section, I’ll cover control flow in C#. Most of the condition and looping statements in C# comes from c and C++. Those who are familiar with java will recognize most of them, as well.

The if . . .else Statement 
The if . . .else statement is inherited from C and C++. The if . . .else statement is also known as a conditional statement. For example:
if (condition)
statement
else
statement

The if. . .section of the statement or statement block is executed when the condition is true; if it’s false, control goes to the else statement or statement block. You can have a nested if . . .else statement with one of more else blocks. 

Program Control Statements

The program flow in high - level languages is sequential. A program is usually not limited to a linear sequence of instructions. Therefore there is a use of control structures that serve to specify what to do with our program and how.
C++ provides statemets to perform efficiently and effectively. Such statements are called program control statements. These are selection statements ( if and switch), iteration statements (for, while and do-while) and jump statements such as (return, goto, exit(), break and continue)
Statements
Statements are instructions given to the computer to perform an action such as moving data, taking decisions or repeating actions. LEARN MORE>>