- Learning to Program—The stages of programming
- Learning to Program – Some Terms You Should Understand
- Learning to Program – IPO Charts (Stage 1)
- Learn to Program- Flowcharting (Stage 2)
- Learning to Program – Flowcharting (Stage 2). — Decisions and Loops
- Learning to Program—Flowcharting (Stage 2) – Case Statements
- Learning to Program (Stage 2)—Flowcharting – Methods and Classes
- Learning to Program – Structure and Spaghetti Code
- Learning to Program – Pseudocode (Stage 3) an overview
- Learning to Program – Stage 3 Pseudocode commands and reserved words
- Learning to Program—Stage 3 Pseudocode examples Part 1
- Learning to Program – Stage 3 Psuedocode (Arrays)
- Learning to Program – Stage 3: Pseudocode—Methods
- Learning To Program—Stage 3.5 (UML Diagrams)
- Learning to Program – (Stage 4) Coding
- Learning To Program—Stage 5 Testing
- Learning to Program—Stage 6 (Documentation)
- Learning to Program – Stage 7 (Maintenance)
- Learning to Program—Random Thoughts with a Theme
- Learning to Program- Two Main Types of Errors
- Learning to Program – Integrated Development Environments (IDE’s)
- Learning to Program
As I mentioned in the last post, pseudocde phrases vary, depending on whether you are using a generic version or language specific version. The pseudocode that I will be showing you is generic. You can use it to convert to any language because the phrases are not syntax specific.
START: This is the start of your pseudocode. It compares to the start symbol (oval) in your flowchart.
INPUT: This is the input that you use when the user will type a value in. It corresponds to the parallelogram symbol (input) in your flowchart.
GET: This is the input that you will use when reading from a data file. Like Input, it corresponds to the parallelogram symbol in your flowchart.
PRINT: This is how you will output to the screen. It corresponds to the parallelogram symbol in the flowchart also (The symbol is both input/output).
WHILE: This is the keyword for the while do loop (or while endwhile loop). There is no corresponding symbol in the flowchart, but it can be represented by the loop where the condition is at the beginning.
ENDWHILE: This is how you’ll show the end of the statements inside of the while loop.
FOR: This is the beginning of a for loop. In the flowchart, the for loop is represented by the initial value being set, then the condition being checked, and the statements being carried out if the conditions is not true (along with an incrementer for the variable).
ENDFOR: This is the pseudocode representation of the end of the statements inside of the for loop.
IF- THEN: This is the decision statement “If condition is true, then”. It’s represented by the diamond symbol in the flowchart.
ELSE: This is the statement that is used if the condition is false, and you want to perform some action in that situation.
ENDIF: This is how you will denote the end of the if-then-else statements.
CASE: This will follow the Select statement and will allow you to streamline the actions based on which condition is true. You will select the variable by saying “Case based on variable”.
BREAK: This isn’t necessary, however some programming languages require this inside of the case statement to ensure that only the specific actions are taken. It’s good to put in for pseudocode, but you should check to see if it’s required for the language that you’ll be coding in.
ENDCASE: This is the end of the case block.
DO: This is the statement that you will use for a DO UNTIL Loop. As I mentioned in the terms post, this is hardly ever used. It’s represented by the loop where the condition is at the end in flowcharts.
UNTIL: This is the statement that will end your DO Until loop and should include the condition.
STOP: This is the last statement in the main portion of your pseudocode. It’s represented by the Stop (oval) in your flowchart.
RETURN: This is the end statement in a method or class. It is represented by the stop symbol (Oval) in a flowchart. Your methods will appear AFTER the Stop command in your pseudocode, however in some languages the actual methods must appear before they are used.
You will want to put the keywords in all caps to differentiate from other words and phrases in the pseudocode.
Some other words that you will use are:
num: representing numeric or decimal types.
char: representing single characters, numbers, or symbols.
string: representing multiple characters, numbers that are not going to have mathematical operations performed on them, or symbols.
boolean: representing true and false.
In my next post, I will demonstrate some examples of pseudocode.
Have a great day:)