You are on page 1of 2

Psuedocode:

Psuedocode is actully a program design technique. We design a program in order to anticipate the logic
and programming.

Psuedcode also has syntaxes and symantics but the rules are easier to understand and
programmer-friendly. It helps the programmer and/or other people to easily understand the complex
programming logic.

Psuedocode Syntaxes: (Remember syntaxes (Keywords) are always written in upper case.)

1. Sequence:

DO

Statements explained in an understandable way.

END DO

For output in the console:

DISPLAY <displayed text>

E.g.

DO

DISPLAY totalRent being accumulated.

END DO

For input into console:

INPUT <what input>

E.g.

DO

DISPLAY a message asking for the user's name

INPUT user's name

END DO

2. Selection Construct:
if()..else
if()..else if()...else
switch()

if()..else

IF <condition>
DO
Statements in descriptive way.
END DO
ELSE IF <Condition>
DO
Statements in descriptive way.
END DO
END IF

E.g.
IF the car is on rent
DO
DISPLAY message informing the user that car is not available.
END DO
ELSE
DO
..
..
END DO
END IF

3. Iteration Construct:

a) WHILE <condition>
DO
..
..
END DO
END WHILE
b) REPEAT
DO
..
..
END DO
UNTILL <condition>

You might also like