Thursday, 26 May 2011

200-300 Word Write-up


IF/Else

If/Else is a statement used in programming which performs different actions depending on whether a programmer-specified condition is true or false. The programmer would use this code if the number of outcomes were more than 1 depending on conditions. For example, IF condition 1=true, then ‘do this’, ELSE ‘do something else’.

I tried to show this statement using a Flash Animated App that is made up of 3 decisions, or if statements, with each one changing the way the animation looks or progresses. The app is based around the purchasing of alcohol, with the main (and final) If/else statement being:  IF age >18 THEN alcoholpurchase=true. Else Denied.

There are other IF statements in the app that alter the progress and outcome of this task. For example, the first decision that has to be made is to choose to wear a suit and a fake beard in order to look much older with the chance of not getting asked for your age, ultimately skipping the last input and successfully purchasing alcohol. There is only one way to progress without being asked for your age, and that is if you wear the suit/beard, and you choose to buy other items, disguising the alcohol, or distracting the cashier from the intended purchase. Ultimately, if you choose the option of being over 18, you will get the alcohol. The only way to be denied of the alcohol is if you select the option of being under 18.

No comments:

Post a Comment