100% found this document useful (1 vote)
261 views

Pseudocode Syntax Cheatsheet

This document provides an overview of pseudocode syntax including: 1. Declaring variables and arrays. 2. Mathematical and comparison operators. 3. Conditionals such as IF-THEN-ELSE statements and CASE-OF-OTHERWISE constructs. 4. Common iteration structures like FOR-NEXT loops, REPEAT-UNTIL loops, and WHILE-DO loops.

Uploaded by

DeadBunny
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
261 views

Pseudocode Syntax Cheatsheet

This document provides an overview of pseudocode syntax including: 1. Declaring variables and arrays. 2. Mathematical and comparison operators. 3. Conditionals such as IF-THEN-ELSE statements and CASE-OF-OTHERWISE constructs. 4. Common iteration structures like FOR-NEXT loops, REPEAT-UNTIL loops, and WHILE-DO loops.

Uploaded by

DeadBunny
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Pseudocode Syntax A-Z

1. Declaring a variable 5B. CASE OF ... OTHERWISE ... ENDCASE

X <- 5 INPUT FoodToBuy


name <- “Adam” CASE OF FoodToBuy
Milo : OUTPUT “Here’s your milo”
2. Mathematical operators Biscuit: OUTPUT “Here’s your
biscuit”
OTHERWISE: OUTPUT “The
canteen does not have this food”
ENDCASE

6. Iterations (Repeat)
6A. FOR ... TO ... NEXT ...
- Used when the number of
iterations is fixed.
3. Comparison operators FOR Counter <- 1 TO 10
OUTPUT Counter
NEXT

6B. REPEAT ... UNTIL ...


- Used when the number of
iterations is not known, that is
completed at least once.
4. Declaring an array (a variable that stores a REPEAT
list of items). OUTPUT “Hello”
INPUT Option
DECLARE MyClass : ARRAY[1:10] OF UNTIL Option = -1
STRING
6C. WHILE ... DO ... ENDWHILE
DECLARE = Keywords
- Used when the number of
MyClass = variable name (can be any name
iterations is not known, that may
you like)
never be completed even once
ARRAY[1:10] = Create an array of size 10
OF STRING = The data type of the array
- STRING = “WORD” Total <- 0
- INTEGER = NUMBERS (eg. 5, 6) OUTPUT “Enter value for mark, -1 to finish”
- FLOAT = Decimal number (eg. 5.6) INPUT Mark
WHILE Mark <> -1 DO
To access the Nth element of an array, do: Total <- Total + Mark
ArrayName[N], where N is the position OUTPUT “Enter value for mark, -1
to finish”
5. Conditionals INPUT Mark
5A. IF ... THEN ... ELSE ... ENDIF ENDWHILE
INPUT Age
IF Age < 18
THEN
5B. CASE OF ... OTHERWISE ... ENDCASE
OUTPUT “Child”
ELSE
OUTPUT “Adult”
ENDIF

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy