Allows the program to make a decision about which code to execute. If the test evaluates to true, the statements enclosed within the block are executed and if the test evaluates to false the statements are not executed.
:ELSE:
Extends the if() structure allowing the program to choose between two or more block of code. It specifies a block of code to execute when the expression in if() is false.
This is the first example that i found, when the mouse is moved from left and right of the screen, the picture changes from daylight to night to raining. The 'If' statement is used in this case - when mouse is left, raining, when mouse is right, nightand when mouse is in the middle, daylight.

http://www.openprocessing.org/visuals/?visualID=11028
Another example that I found was a short story/animation using many if/else statements.

http://www.openprocessing.org/visuals/?visualID=21309
the final example that I found was a maze based on alice and wonderland, they also include many if else statements. In this case the statements were used so that the user and choose a direction to go in the maze, if clicked on left, the maze would travel to a specified slide next, if clicked right, then the slide specified for that side would run next.

http://www.openprocessing.org/visuals/?visualID=7810
No comments:
Post a Comment