Beginning:-


Expression , operator and separator can be combined to manipulates data in a variety of ways. The ability to make decision in the program. Every programming language provides some constructs which are necessary to take decision in the program. 

Control Flow

Control flow instruct the program how to make decision and further the processing should proceed on this basis of that decision. Control flow gets your computer to start doing some of the thinking of yours. Each of the statement like if, if....else and if....else...if can be used to control how your program executes by determining if a condition is true and then executing  a different section of a code , based on the result. This is called as conditional operators. 

Conditional Expression

Conditional expression will generally executes one of the several section of codes on the basis of a conditional test. Conditional expression are used to make decisions in the program. They are used to evaluate whether a condition is true or false and will branch to different sections of codes on the basis of the answer.

If statement

The simplest, but the most important expression is the IF statement. An IF statement makes up a conditional expression. 

The syntax of if statement is given below:-

if (expression)
statement;

OR

if (expression)
{
   statement 1;
   statement 2;
.......................
}

If the expression in the parenthesis evaluates to the boolean true, statement(s) are executed. If the expression evaluates to false, statement is skipped and execution continues at the statement following the IF statement.

If-Else Statement

There is an optional companion to the if statement that can extend its usefulness :the else statement . The statement following the if expression evaluates to true. The statement following the else statement is executed only when that IF expression evaluates you to false. 

The syntax of IF-ELSE statement is given below:-

if (expression)

Statement ;
else
Statement;

OR

if (expression)
{
    Statement 1; 
    Statement 2;

........................
}

else

{
   Statement 1;
   Statement 2;
.....................................
}


Here, if the expression evaluates to true then the statement after if will be executed . If the expression evaluates to false , then the statement after else will be executed.





Subscribe my YouTube Channel:- CLICK HERE












Post a Comment

Previous Post Next Post