What is pseudocode?
When you are just beginning to learn programming, there is a lot to learn before building your first application. Thinking as a programmer helps you break down problems into algorithms to solve them. Algorithms are the steps that your code will take to solve a problem or answer a question.
This can be challenging if you're just starting out. Turning ideas into actual code takes some practice.
To bridge the gap between what you want the application to do and the actual code to write, you can use pseudocode.
Learn about Pseudocode
- What is pseudocode?
- How useful is pseudocode?
- How to write pseudocode
- Condition
- Repetition
- Jaw
- Error handling
What is pseudocode?
Pseudocode is a plain text description of a piece of code or algorithm. It is not really programming, no scripts, no files and no programs. As the name implies, it is a 'pseudocode'.
Pseudocode is not written in any specific programming language. It is written in English and easy to understand.
Although pseudocode is not written in a programming language, there are still keywords used to refer to common concepts when writing code. They are written in capital letters for easier reading.
- START
- INPUT
- READ / GET
- PRINT / DISPLAY
- CALCULATE / DETERMINE
- SET
- INCREMENT / DECREMENT
- PROGRAM
- END
Here's a snippet of how pseudocode might look for a program that asks you to enter your favorite color and output your selection.
START PROGRAM getColor Create variable Color Ask the user for their favorite color READ INPUT into Color PRINT Color END
This is a fairly simple algorithm written in pseudocode. Anyone can read and understand what it is trying to accomplish.
As a programmer, all you have to do is bring it to life using whatever programming language you write code in. This is the same program in JavaScript:
let color = window.prompt("What is your favorite color?"); console.log(color);
This program uses JavaScript syntax to write algorithms. If you don't know JavaScript, it can be a little difficult to find out what's going on.
Pseudocode writes algorithms, programming languages that write syntax.

How useful is pseudocode?
Pseudocode helps you plan your application before writing. It helps you create algorithms that are easier to read than code syntax.
The JavaScript example is easy to read if you know this programming language. Specific terms like window.prompt or console.log don't reveal much about the algorithm.
If you interview to become a software engineer, the employer will not want you to remember the syntax. They will ask your knowledge about algorithms and structures. You will write much better code if you build your algorithms and structure before you start writing code.
How to write pseudocode
Writing a full program using pseudocode requires a lot of different commands and keywords just like regular programming. Please rely on keywords with pseudocode statements to build algorithms.
Condition
Conditional statements are very important in programming. These statements are IF statements or IF / ELSE statements, which can add logic to the code. These statements are written in pseudocode, using:
- IF
- ELSE
- ELSE IF
- THEN
Here, the program implements a simple IF / ELSE statement written in pseudocode. Let's see if you can determine what this code is trying to do just by reading it.
START PROGRAM isOdd Create variable Choice Ask the user for a number READ INPUT into Choice IF Choice is even THEN PRINT "No" ELSE PRINT "Yes" ENDIF END
It's a fairly simple program, asking users to give a number and do something depending on whether it is an odd or even number.
Repetition
Another essential part of programming is iteration, also known as loop creation. Some common loops are for and while . Both can be written in pseudocode.
START PROGRAM forLoop FOR 1 through 12 PRINT "Hello" ENDFOR END
This algorithm for a program will print 12 times the word 'Hello' . This shows how simple it is to write a loop in pseudocode.
While loops are also written very easily
START PROGRAM whileLoop Create variable Counter SET Counter equal to 1 WHILE Counter is less than 10 Print "Hello" INCREMENT Counter ENDWHILE END
Another fairly simple algorithm uses the while loop to print 'Hello'. Both loop examples have an explicit start and end to allow iteration.
You can also write do-while loops. The keywords in pseudocode will be REPEAT and UNTIL.
START PROGRAM doWhileLoop Create variable Counter SET Counter equal to 1 REPEAT Print "Hello" INCREMENT Counter UNTIL Counter is equal to 10 END
Like a do-while loop, this will perform an action until certain criteria are met. Once it is met, the loop will exit.
Jaw
Ham is the best programmer friend. They contain code that can be invoked and used in all high-level programming languages. Adding functions to pseudocode is easy.
START PROGRAM sampleFunction PRINT "This is a function" END
You can call functions in pseudocode.
call sampleFunction
The function is very simple and you can add any logic you like.
Error handling
Being able to write code that responds to bugs is very important when applications are developed. You can include this code in your pseudocode.
You can handle errors and exceptions by using keyword: EXCEPTION. Here, a simple algorithm will 'catch' the error
START PROGRAM catchError Create variable Number Ask the user for a number READ INPUT into Number EXCEPTION WHEN Number is not a number PRINT "Error: Please pick a number" END
Testing code is very important to writing good applications. Some of these exceptions will reappear in your tests, so it's good to write them in your pseudocode when planning your application.
You should read it
- How to Become a Computer Scientist
- How to Write Emotional Roleplaying Posts
- How to write curves in Photoshop
- Learn about Server role, Role service and Feature on Windows Server
- Learn about the Write Zero method
- Why write neat and organized HTML?
- How to enable / disable Disk Write Caching in Windows 10
- Henry Cavill officially dropped the role of Superman, DC will also give up everything to start again
May be interested
- How to use GoChat application in Pokémon GOpokémon go has become a very hot phenomenon since its debut. any information or tricks related to the game are read and applied by players during the process of catching pokémon. and the gochat chat app for pokémon go players brings space to capture pokémon much more interesting.
- How to play Pokemon GO in Landscape Mode on the iPhonealthough players can play pokemon go in portrait mode. however, if you want to watch and play games on a large and eye-catching screen, players can switch to playing games in landscape mode.
- The secret to controlling Pokemon Go employees at workthese days, hr managers are faced with an extremely painful problem that is the status of priority employees playing pokemon go more than work. this has caused a small impact on productivity and efficiency.
- Check out the 'buffalo' Pokémon in Pokémon Goeach type of pokemon has hp, cp, ability to attack and endure differently. based on these indicators, players can determine as well as choosing the most powerful pokemon for their offensive tactics.
- Sitting home can also locate Pokemon around, do you believe it?the tightening of the niantic developers' rules to prevent players from abusing the support tools also brings annoyance, such as those who have no conditions to move much, go away, it is hard to know. get the location of the pokemon around the area they live in
- 5 undeniable benefits when playing Pokemon Goget to know many new people, breathe fresh air, relieve stress, increase concentration thanks to going out for a walk .... are compelling reasons to force you to try pokemon go now .
- Want to earn the fastest Pokécoins in Pokémon Go? So don't miss this article!pokécoins in pokémon go play the role of buying items in the store. the more coins you earn, the more likely you are to buy more items. to earn pokécoins, players will have to complete certain tasks or buy real money.
- Pokémon systems when fighting in Pokémon Goeach pokémon system in pokémon go has different strengths, along with a specific weakness. this type of pokémon will have the power to attack the other pokémon, but can defeat the other pokémon. if you know the characteristics of each type, it will be easier to choose which pokémon to battle.
- The terms you need to know when playing Pokémon Gopokémon go is the most prominent name in recent days. this game of capturing and training virtual animals has created a relatively new way of playing, as players have to constantly move to catch pokémon. during the process of joining pokémon go, you will encounter and use a lot of important terms. so what do they mean?
- How to play Pokemon GO on Windows computersrecently, pokemon go has become a popular game, attracting thousands of gamers around the world. in previous posts network administrator has guided you on how to play pokemon go on android devices and ios devices. in the article below, network administrator will guide you how to play pokemon go on windows computers using bluestacks emulator software.