Thursday 11 April 2013

If …Then … Else statements


If …Then … Else statements

The If Then statement tests whether an If condition is true or false - if it is true Then will execute  

The If Then Else statements test whether an If condition is true or false – if it is true Then will execute – if it is false Else will execute  

These can be used to test input values and match it against multiple conditions to provide an outcome based on whether the value is validated as true or false

The value will be tested against each condition, in order, until it is found true

If none are true Else will execute

Eg.       if Y = 1 then print 1
            if Y = 2 then print 2

            If Y = 3 then print 3    

            else print fail


Original Post Mar 4th 2012

No comments:

Post a Comment