What is the difference between If and Else If? - ProProfs Discuss
Topics
Products
Follow Us:

What is the difference between If and Else If?

Asked by G. Cole, Last updated: May 27, 2020

+ Answer
Request

1 Answer

Christian Jackson

Christian Jackson, Content Developer, Austin

Answered Apr 08, 2020

It can be confusing to know the difference between if and if-else in the beginning. Take note that these are used in the C language. The “if” statement is used if the condition is true. This means that if the condition is false, it will not do anything. The “if-else” statement, on the other hand, checks the statement first and will ask if the condition is true. Once proven true, it will execute a series of commands.

If the condition is false, it will execute a series of commands that are also different. For example, if you would like to prove if a number is odd. If you would use an “if” statement, it will not do anything if the number is even. If you are going to use the if-else statement, the tasks that will be done are also going to be different.

 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.