Pseudo code is way of describing steps or instructions for a computer program. This is a basic way of planning the code and testing that it works before actually writing the code in the application.
We use KEY words to describe each instruction. They must be in capitals and these include:
BEGIN - start of program
END - end of program
INPUT - grab a value from the user with a prompt
OUTPUT - display contents to the output window
IF - ask a yes or no question
ELSEIF - ask another question
ELSE - if the question above is not true then do this instead
ENDIF - end of if statement
FOR - start a loop
ENDFOR - End loop
BEGIN
INPUT username_var
INPUT year_of_birth_var
age_var = 2017 - year_of_birth_var
OUTPUT = username_var AND age_var
END
Get the name of the user
then get their year of birth
calculate their age by taking the current year away from their year of birth
output their name and age to the screen
BEGIN SizeofNumber
INPUT age_input
IF age_input > 50 // > greater than
Output_txt = “Your number is larger than 50”
ELSE IF age_input <50
OUTPUT = “Your number is smaller than 50”
ELSE IF age_input == 50
Output_txt = “Your number is spot on 50”
END IF
END
Get a number from the user
If the number is more then 50 - output "Your number is greater than 50"
otherwise if the number is less then 50 - output "Your number is less than 50"
else if the number is equal to 50 - output "Your number is spot on 50"
BEGIN BasicMaths
OUTPUT number1_var + number 2_var
answer_var = number1_var + Number2_var
GET UserAnswer
IF UserAnswer == answer_var
OUTPUT "That was correct - WELL DONE!
ELSE
OUTPUT "Sorry that was the incorrect answer. The correct answer was " + answer_var;
END IF
END
Pseudocode slideshow - click here for pseudocode information and examples
Pseudocode video - click here to watch