If statements | SoloLearn: Learn to code for FREE!

+1

If statements

its easy because its just a choice between if and else and what happens when either becomes greater or less than the variable indicated in it..

12/22/2016 1:20:38 PM

peter maina

2 Answers

New Answer

+4

It can actually be a choice between an infinite number of 'if's and 'else's. E.g. if (x == 1) { // do something } else if (x > 1) { // do something else } else if (x < 1) { // do other things } etc. As you can see, no matter how the value of x changes, it will not exceed the boundaries of the conditional statements because I have defined conditional statements which covers the entire scope of integers. It is up to one to decide how to define their conditions.

0

I understand now, if the if statements are false,then it goes straight to the else statement.