Learn Tech Skills


Pseudocode is similar to code, but much easier to understand. Writing in pseudocode is like sketching for programmers.

Before an artist starts a painting, they first sketch their idea in pencil. When programmers want to sketch their ideas, they do it in pseudocode. Pseudocode isn’t code because a computer would not be able to understand it, instead it’s shorthand for what you are planning to code.

When you write a computer program, it might look something like this:

#include <iostream>
#include <string>
using namespace std;

int main ()
string name;
cout << "What's your name? ";
getline (cin, name);
cout << "Happy Birthday" << name << "!n";
return 0;

That program says: ask for a person’s name, then say “Happy Birthday, [insert name here]”. But you wouldn’t necessarily know that, because it’s written for a computer to read, not for a person.

Beyond not being very attractive, for that code to run successfully it needs a lot of little nitpicky elements – you need the semicolons at the end of lines, you need to make sure to put your brackets in all the right places (and make sure you use the right kinds!). Any one small punctuation error will break the entire program.

If you’re just making a quick sketch of a program or are still in the planning stage, you don’t want to spend so much time perfecting your semicolon usage. You’d rather just think about getting things done!

That’s where pseudocode comes in. If we wanted to write the program above in pseudocode, it might look like this:

ask name
say “Happy Birthday, name”

We stripped out all of the ‘extra’ bits and focused on the part that matters – asking someone’s name and saying “Happy Birthday.”

There is no one way to write pseudocode – different programmers write pseudocode differently, and it can also depend on which programming language they’re writing pseudocode for. Each language is a little bit different, so you might want to write your pseudocode more or less in the fashion of the language it’s destined to be in.

But remember, pseudocode can’t be understood by a computer! It’s only readable by people, and is more of a thought exercise than anything else. So no matter how easy it is to read, at some point it’s going to have to be decked out in semicolons and assorted brackets.