Using Pseudocode to Map Code

An error occurred trying to load this video.

Try refreshing the page, or contact customer support.

Coming up next: Data Types in Programming: Numbers, Strings and Others

You're on a roll. Keep up the good work!

Take Quiz Watch Next Lesson
 Replay
Your next lesson will play in 10 seconds
  • 0:05 Steps to Writing a Program
  • 0:32 Pseudocode
  • 1:33 A Simple Example
  • 3:13 No Standard But Guidelines
  • 5:32 Lesson Summary
Add to Add to Add to

Want to watch this again later?

Log in or sign up to add this lesson to a Custom Course.

Login or Sign up

Timeline
Autoplay
Autoplay
Speed
Lesson Transcript
Instructor: Paul Zandbergen

Paul has a PhD from the University of British Columbia and has taught Geographic Information Systems, statistics and computer programming for 15 years.

Pseudocode is a plain English version of the detailed steps of a computer program that can be read by non-programmers. Learn about using pseudocode to implement the logic of a program before writing the actual code.

Steps to Writing a Program

The general steps for writing a program include the following:

  • Understand the problem you are trying to solve
  • Design a solution
  • Draw a flow chart
  • Write pseudocode
  • Write code
  • Test and debug
  • Test with real-world users
  • Release the program
  • Iterate the steps for the next version

This lesson will look more closely at using pseudocode.

Pseudocode

A computer program is written in a language that a computer can understand. There are hundreds of different programming languages, each with their own logic and syntax. Writing code is not difficult but requires great attention to detail and can be very time consuming.

In order to start writing a program without having to worry too much about the details of a specific programming language, programmers use pseudocode. Pseudocode is a plain English version of the detailed steps of a computer program that can be read by non-programmers. Pseudocode is written in English so that humans can easily understand it, but it looks like programming. However, pseudocode is not an actual programming language. It contains well-defined structures that resemble programming languages, but these are not unique to one particular language.

You may also encounter pseudocode in textbooks on computer programming. Instead of focusing on the syntax of one specific language, the textbook may teach the logic of programming using pseudocode.

A Simple Example

Let's look at a very simple example. Let's say a bank customer wants to use an ATM to withdraw $100 cash from her account. You need to program for the ATM to check the customer's balance and determine if there is enough money in the account. The pseudocode would look something like this:


Pseudocode


You don't need to be a programmer to understand this code. In fact, if you were to read out this code, it almost sounds like regular English. On the other hand, the logic and structure is starting to look a lot like code.

The example illustrates some of the basic aspects of pseudocode. First, every instruction is printed on a new line. The logic of the problem needs to be broken down into small steps that are very specific.

Second, pseudocode uses some key programming terms, such as 'if' and 'else.' The use of if-else is a fundamental construct in programming, known as a selection or decision statement. Based on a condition, only one of multiple options is carried out. Every programming language uses these types of if-else constructs. However, the details on exactly how this logic is implemented will vary among languages. When you are writing pseudocode, you don't worry about those differences and focus on the general logic.

Third, individual lines of pseudocode often start with action words that tell you to do something, as you might expect for a series of instructions. Verbs like 'print,' 'read,' and 'calculate' are common. These verbs correspond closely to commands in programming language, although the actual term may be different.

No Standard, But Guidelines

There is no standard for pseudocode, and different programmers will have different styles. For example, some will use capital letters for key terms to make them easier to recognize, and others will use small letters. While being consistent makes your pseudocode easier to read, there is no right or wrong style.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 160 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create An Account
Support