Professional Documents
Culture Documents
Module main()
This is required for all programs. It represents the start of the program. The first line in your
Pseudocode must be Module main( ) followed by the remaining steps for the program.
Declaration of variables
Variables have to be declared in your program in order for you to use them. Variables require
three items when declaring them: The Declare keyword, followed by the data type for the
variable (Integer, Real, or String), and finally the name of the variable. Variables should be one
word or two words joined with an underscore. For example, Declare Integer age or Declare Real
user_weight
Let us take a look at two example programs from beginning to end using the steps listed above.
Example One - This program will ask the user to enter in their name and display a thank
you message
//Start the program
Module main()
//Declare variables
Declare String name
Example Two – This is a modular program that will ask the user for two numbers, will add
the results, and display the results back to the user. Two additional modules will be used
addNumber() and displaySum()
Call displaySum(summation)
//This module takes the two numbers entered by the user, adds them together, stores
the value in the variable sum, and sends that information back to the Module main()
Module addNumber(Integer num1, Integer num2, Integer Ref sum)
Set sum = num1 + num2
End Module