No standard for pseudocode syntax really exists. However, there are some commonly followed conventions to help make pseudocode written by one programmer easily understood by another programmer. Most of these conventions follow two concepts:
Use indentation to show the action part of a control structure
Use an ending phrase word to end a control structure
The following are commonly used ending phrase-words:
Control Structure Ending Phrase Word
If
Else
End IF
Select Case
Case
Case
Endcase
While
Endwhile
For
Next
Example 1: pseudocode: If then Else
If age > 17
Display a message indicating you can vote.
Else
Display a message indicating you can't vote.
End if
Example 2: pseudocode: Case
Case of age
case 0 to 18 Display "You can't vote."
case 19 to 64 Display "Your in your working years."
case 65 + Display "You should be retired."
End case
Example 3: pseudocode: While
count assigned zero
While count < 5
Display "I love Sri Lanka!"
Increment count
Endwhile
Example 4: pseudocode: For
For x starts at 0, x < 5, increment x
Display "Are we having fun?"
Next
Example 5: pseudocode: Do While
count assigned five
Do
Display "Blast off is soon!"
Decrement count
While count > zero
Example 6: pseudocode: Repeat Until
count assigned five
Repeat
Display "Blast off is soon!"
Decrement count
Until count < one