Someone can explain me more about{if and alse} becouse I getting confused?? | SoloLearn: Learn to code for FREE!

+2

Someone can explain me more about{if and alse} becouse I getting confused??

6/5/2017 4:57:13 PM

Sucdi

3 Answers

New Answer

+5

if this statement is true, do something. else, if that was false, if this statement is true, do something. else, if everything was false, do something. Or, if written in code: if(condition) { // do something if true } else if(condition) { // do something if true, if above was false } else { // do something if all are false } *for statements that are not nested*

+2

if: You evaluate for example the two variables. When your evaluation is true the execution of the code in {} of the if statement will continue. else: when the none of the statements are true you use else

+1

Think of else as meaning "otherwise" as in.. If it's a weekday go to work otherwise stay at home. if (weekday) { dowork(); } else { stayhome(); }