Monday, September 26, 2016

If else in Code.org


Image result for if else statement in code.org
If Else statements are used to decide between two or more options if the requirements are met for example.

if (time < 10) {
greeting = "Good morning";
 } else if (time < 20) {
greeting = "Good day";
} else { 
greeting = "Good evening";
}


The same rules apply but the code is hidden behind the blocks making it easier for the user to under stand. They are similar in that they both give the computer steps to go by depending on what instructions activate the statements below but they are different in that one is capable of more else statements where as the code.org is set to how many you can use.

No comments:

Post a Comment