0% found this document useful (0 votes)
56 views3 pages

Pseudocode Syntax Cheat Sheet

This document is a cheat sheet for O Level Computer Science 2210, outlining pseudocode syntax for variables, input/output, decision-making with IF statements, loops, arrays, procedures, functions, and comments. It provides examples for each concept, demonstrating how to assign values, make decisions, repeat actions, store data, and create reusable code blocks. The cheat sheet serves as a quick reference for students learning pseudocode programming.

Uploaded by

hamza Shahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views3 pages

Pseudocode Syntax Cheat Sheet

This document is a cheat sheet for O Level Computer Science 2210, outlining pseudocode syntax for variables, input/output, decision-making with IF statements, loops, arrays, procedures, functions, and comments. It provides examples for each concept, demonstrating how to assign values, make decisions, repeat actions, store data, and create reusable code blocks. The cheat sheet serves as a quick reference for students learning pseudocode programming.

Uploaded by

hamza Shahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

O Level Computer Science 2210 –

Pseudocode Syntax Cheat Sheet


1. Variables and Assignment
x←5

name ← "Ali"

→ Assigns 5 to variable x and "Ali" to name.

Use ← instead of =.

2. Input and Output


INPUT name

→ Asks the user to type something.

OUTPUT "Hello", name

→ Displays Hello followed by the name on screen.

3. IF Statements (Decision Making)


IF score >= 80 THEN

OUTPUT "A"

ELSEIF score >= 70 THEN

OUTPUT "B"

ELSE

OUTPUT "Fail"

ENDIF

→ Makes decisions based on conditions.

4. Loops (Repetition)
FOR i ← 1 TO 5
OUTPUT i

NEXT i

→ Repeats 5 times.

WHILE count <= 5 DO

OUTPUT count

count ← count + 1

ENDWHILE

→ Repeats while a condition is true.

REPEAT

INPUT num

UNTIL num > 0

→ Repeats until a condition becomes true.

5. Arrays
DIM scores[3]

scores[0] ← 50

scores[1] ← 60

scores[2] ← 70

→ Stores multiple values in one variable.

6. Procedures and Functions


PROCEDURE Greet(name)

OUTPUT "Hello", name

ENDPROCEDURE

→ Reusable block that performs an action.


FUNCTION Square(x)

RETURN x * x

ENDFUNCTION

→ Reusable block that returns a value.

7. Comments
// This is a comment

→ Use comments to explain what your code does.

You might also like