Before you start to think of how it works, relax you mind first don't think of complicated stuff first. Computers are not complicated as a human being, computer is just yes and no while a human can answer yes,no and maybe.
How the IF/THEN/ELSE structure function is simple. The computer will either execute Instructions for the True statement or the False statement.
Take the Algorithm below as an example.
IF (x=5) THEN
{ DISPLAY "The value of X is now 5"}
ELSE
{DISPLAY "The value of X is not 5"}
END IF
From the example above, if it fulfills the condition when x=5 then computer will execute the instruction for the true statement. If it does not fulfills it, it will skip through the instruction and proceed to the else part (FALSE part).

No comments:
Post a Comment