If statements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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..

22nd Dec 2016, 1:20 PM
peter maina
peter maina - avatar
2 Answers
+ 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.
22nd Dec 2016, 4:43 PM
Hatsy Rei
Hatsy Rei - avatar
0
I understand now, if the if statements are false,then it goes straight to the else statement.
1st Jan 2017, 4:07 PM
Tails Ex Machina
Tails Ex Machina - avatar