Pages from !Pseudocode Guide-12
Pages from !Pseudocode Guide-12
5. DECISION MAKING
Decision making or branching is a way to direct the flow of pseudocode depending upon a particular
condition. We can use these constructs to check for a condition and depending upon the result either
do something or not.
There are 2 constructs for decision making in pseudocode; CASE‐OF and IF‐THEN.
IF‐THEN have 2 variations; one which checks single condition and the other which can check against a
series of conditions. Both have slight differences in their syntax and are explained below.
IF – THEN (Single condition)
IF condition THEN
instructions
END IF
Where:
condition is the condition to evaluate. Its answer will always be in the form of True or
False.
instructions are the pseudocode statements that will only be executed if the condition
evaluates to true. In simple words, these lines of code will only run if the condition’s answer is
True otherwise they will not run and computer will directly jump to line after END IF
statement
Example
IF weight < 20 THEN
PRINT “You are underweight”
END IF
11