Please note, this is a STATIC archive of website www.javatpoint.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
Javatpoint Logo
Javatpoint Logo

R else if statement

This statement is also known as nested if-else statement. The if statement is followed by an optional else if..... else statement. This statement is used to test various condition in a single if......else if statement. There are some key points which are necessary to keep in mind when we are using the if.....else if.....else statement. These points are as follows:

  1. if statement can have either zero or one else statement and it must come after any else if's statement.
  2. if statement can have many else if's statement and they come before the else statement.
  3. Once an else if statement succeeds, none of the remaining else if's or else's will be tested.

The basic syntax of If-else statement is as follows:

Flow Chart

R else if statement

Example 1

Output:

R else if statement

Example 2

Output:

R else if statement

Example 3

Output:

R else if statement

Example 4

Output:

R else if statement

Example 5

Output:

R else if statement
Next TopicR Switch Statement





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA