Skip to main content

Command Palette

Search for a command to run...

Control Statements

Published
1 min read

‘Nested if’ statement

Nested if in C++ is using more than one if statements in the same scope. The if statement is a decision-making statement that allows taking decisions based upon the condition specified.

Example

Input

Output

if – else if – else statement

An if-else statement controls conditional branching. Statements in the if-branch are executed only if the condition evaluates to a nonzero value (or true ). If the value of condition is nonzero, the following statement gets executed, and the statement following the optional else gets skipped.

Example

Input

Output