First, you need to understand that pseudocode is not a programming language. Pseudocode cannot be compiled nor executed on a computer, and there is no real formatting or syntax rules. It is simply one step, a very important step, in producing the final code. The benefit of pseudocode is that it enables the designer to concentrate on the algorithms without worrying about all the syntactic details of a programming language. In fact, you can write pseudocode without even knowing what programming language will be used for the final implementation.
Pseudocode consists of short, English phrases used to explain specific tasks within a program's algorithm. Pseudocode should not include keywords in any specific computer languages. It should be written as a list of consecutive phrases.
How to write Pseudocode
[ModuleName] Module
• Keyword
• Must have an End Tag
Example: DisplayResults Module End DisplayResults Module
Declare [DataVariableName] as [DataType]
• DataVariableName can be any name chosen as long as it is one word.
• DataType can be one of the following basic types: Real, Integer, and String. o Real – any positive or negative number that has decimals (2.34, -9.987) o Integer – any positive or negative whole number (768, -98) o String – any alphanumeric value (123 Main Street, Joe Smith)
Example: Declare count As Integer Declare lastName As String Declare price As Real
Display (or Write) [Sting or data variable to be displayed]
• If sting is used, you must have it start and end with quotations
Example 1: Display “Good Morning”
Example 2: Declare lastName As String lastName= “Jones” Display lastName
Example 3: Declare testScore As Integer testScore = 95 Display NumBurgers Display “Your test score is: ”, testScore
Call [ModuleName] Module
• ModuleName must be a valid module declared in the program
Example: Main Module Call DisplayResults Module End Main Module