Skip to main content

Control Statements If Else



Control Statements:
                 Control statements are ways for a programmer to control the program, about what blocks of the program are to be executed at certain number of times. In other words, control statement is a statement that determines whether other statements will be executed. The syntax of control statements are very similar to regular English words. Basically there are two types of control statements: branching statements and loops.
Branching : decides which part of the program executed, 
Loops : decides, which block of program executes certain number of times.



If Else:
This is the most simple form of the branching statements. It is the branching control statement, decides which branch of the program executes. It takes an expression or condition in the parenthesis and executes the statement only when the condition satisfies. If the condition is not satisfies, these statements are skipped. For the nested if, contains multiple If conditions and one else condition blocks will be available, and the conditions are checked by one by one.

Syntax for If Else Statements:

if (Conditions)
{
Block of statements;
} else {
}
Block of statements;

Comments