What is the difference between If and Else If? - ProProfs Discuss
Advertisement

What is the difference between If and Else If?

Asked by G. Cole, Last updated: Apr 19, 2024

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

Christian Jackson

Christian Jackson

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.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

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