Operating Systems/Programming

Pseudocode- Flow Control Methods


Per my last post, we began discussing pseudocode and flowcharts. In this post, I wanted to further explain best practices and tips for creating them.

Flow Control Methods

Pseudocode should always follow a specific flow structure, whether it is sequential, selection, loop, call, etc. While the following examples are not a specific and correct code, they are intended to give a general idea of how it all works (which is exactly what pseudocode does).


Program code performed in the listed order.


  1. Input first number
  2. Input second number
  3. Subtract second number from the first number
  4. Display the difference


The flow of the program is indicated either by choice or a value comparison.


  1. Input number
  2. Check if number is equal or less than a specific number (if it is, then a specified criterion is met)
  3. If the number is not equal or less than a specific number, then a specified criterion is not met
  4. End IF
  5. Continue program flow


Controls the number of times a specific call or sub-routine will execute before the loop ends. Without a loop, the sequence would continue indefinitely.


  1. Perform a task if input is correct
  2. Do not perform a task if input isn’t correct (but loop back to task 1 until it is correct)
  3. Once input is correct, initiate program


Commonly referred to as sub-routines or method calls, these are typically embedded within the program. When a call or subroutine is instructed to execute, the flow is interrupted to start the designated method or sub-routine call.


  1. Call by value- Argument is checked, copied, and passed to the subroutine.
  2. Call by reference- Refers to the argument, the address is passed.
  3. Call by result- Value is copied back to argument on return from the subroutine.
  4. Call by name- Operates similar to a macro. Replaces parameters with unevaluated expressions.

Pseudocode Example

For an example of how this flow operates, I have created what looks like a simple Sequential flow pseudocode, however, if you notice on step 5, there is a setting to have it Loop, which controls how many times the code will execute; below that is this pseudocode’s flowchart.

  1. The even numbers between 20 and 40
  2. Put in the number 20
  3. Add 2 to the number
  4. Output the number
  5. If the number is less than 40, go back to step 3
  6. End

Flow Control.JPG




Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s