Pseudocode/Gaddis Pseudocode

Gaddis Pseudocode refers to the pseudocode language described in the book, "Starting Out with Programming Logic and Design", by Tony Gaddis. The language includes elements for variables, named constants, comments, input / output, operators, conditional statements, loops, subroutines, file processing, and classes.

Variables
Data Types:

Syntax:

Constants
Syntax:

Comments
Syntax:

Input / Output
Syntax:
 * must be a variable or literal
 * must be a variable or literal
 * must be a variable or literal

Math Operators

 * (Add)
 * (Subtract)
 * (Multiply)
 * (Divide)
 * (Modulus)
 * (Exponent)

Relational Operators

 * (Greater than)
 * (Less than)
 * (Greater than or equal to)
 * (Less than or equal to)
 * (Equal to)
 * (Not equal to)

Logical Operators

 * (And)
 * (Or)
 * (Not)

Conditional Statements
If condition Then statements End If

If condition Then statements Else statements End If

Select expression Case value: statements Case value: statements Default: statements End Select

Loop Statements
While condition statements End While

Do statements While condition

Do statements Until condition

For counter = start To end statements End For

For Each variable In array statements End For

Subroutines
Module ModuleName(DataType ParameterName, ...) statements End Module

Function FunctionName(DataType ParameterName, ...) statements Return value End Function

Call ModuleName(parameter, ...) Variable = FunctionName(parameter, ...)

File Processing
Declare InputFile VariableName Declare OutputFile VariableName Declare OutputFile AppendMode VariableName

Open VariableName FileName Read VariableName VariableName Write VariableName item Close VariableName

Open VariableName FileName While NOT eof(VariableName) statements End While Close VariableName

Rename FileName, NewName Delete FileName

Classes
Class ClassName Private DataType FieldName ...   Public Module ModuleName(DataType ParameterName, ...) statements End Module ...   Public Function FunctionName(DataType ParameterName, ...) statements End Function .... End Class

Declare ClassName VariableName Set VariableName = New ClassName