3 Answers
New Answer6/5/2017 4:57:13 PM
Sucdi3 Answers
New Answerif 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*
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
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(); }
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message