Computer Science: Control Statements: Conditional Statements: If Statement

Get top class preparation for UGC right from your home: Get complete video lectures from top expert with unlimited validity: cover entire syllabus, expected topics, in full detail- anytime and anywhere & ask your doubts to top experts.

Download PDF of This Page (Size: 281K)

Image of if else statement

Image of if else Statement

Image of if else statement

Conditional Statements

  • Sometimes the program needs to be executed depending upon a particular condition.

  • C++ provides the following statements for implementing the selection control structure.

Image of Control Statements

Image of Control Statements

Image of Control Statements

‘If’ Statement

  • The if/else statement executes a block of code if a specified condition is true.

  • If the condition is false, another block of code can be executed.

  • The if/else statement is a part of JavaScript's "Conditional" Statements.

Syntax of the ‘if’ statement

If (condition)




Diagram of If statement

Diagram of if Statement

Diagram of If statement

Developed by: