What is Pseudocode: Definition, Examples, Functions and Structures

Are you having trouble learning programming? Understand the code by studying the pseudocode. But what is Pseudocode and is it really useful?

When you first start learning programming, there is a lot to learn before you build your first app. Thinking like a programmer helps you break down problems into algorithms to solve them. Algorithms are the steps that code takes to solve a problem or answer a question.

It can be difficult if you are a new programmer to think like a programmer from the start. Translating app ideas into actual code requires some practice.

To relate what your app wants to do and the code you need to write, you can use pseudocode.

Read also: The difference between high-level and low-level programming languages

Understand the pseudocode

Pseudocode is a plain text description of a piece of code or an algorithm. It’s not really coding, because there are no scripts, no files, and no programming. As the name suggests, it is a “fake code”.

The pseudocode is not written in a specific programming language. The writing method uses simple language to express the algorithm design

Although it is not written in a programming language, there are still keywords used that refer to common coding concepts. Pseudo-code writing also doesn’t have specific rules but it should make sense. It is written in large letters for easy reading. Here are suggestions for writing Pseudocode:

  1. Use uppercase or uppercase for command codes (IF, ELSE, THEN).
  2. every statement (statement) written in one line.
  3. using indents.
  4. specific.
  5. basic.

pseudocode functions

Pseudocode helps you plan your application before writing it. This helps you create algorithms in a more readable format than your code syntax. Once programming languages ​​appear, it will be difficult to understand what your code is doing.

Writing Pseudocode also allows you to have bright ideas in your head without having to worry about programming language syntax. Since it does not have a special syntax, the program is easy to read and write, and programmers can comfortably communicate ideas and concepts, even if they work in different programming languages.

Actually the principle of good software is very important. If you are interviewed to be a software engineer, they will not expect you to memorize grammar. They will ask about your knowledge of algorithms and structures. You will write much better code if you create algorithms and structures before you start coding.

Pseudocode Features

  • Pseudocode is a notation or sign of how problems are systematically and sequentially solved.
  • Pseudocode is used to write algorithms.
  • Pseudocode contains a series of operations to solve problems.
  • The language used is more concise and easy to understand.
  • There are no standard rules for writing Pseudocode.

pseudocode structure

In general, in writing Pseudocode, it is divided into three structures or parts, which are:

  1. Title – Generally, the address begins with “PROGRAM” and is followed by the name of the algorithm.
  2. Advertising This section is the variable declared by the algorithm. This variable can be an integer, a fraction, a literal, a boolean, etc.
  3. algorithm – This is the section that contains a set of algorithm commands. Algorithm commands can be loop, conditional, or sequential.

Important points in writing false code

  1. The pseudocode will be attached by START (or BEGIN) and STOP (or END).
  2. The pseudocode should be brief so ignore unnecessary details.
  3. To receive data from a user, the commonly used statements are INPUT, READ, GET, or OBTAIN.
  4. To display any result or message, the commonly used phrases are PRINT, DISPLAY, or WRITE.
  5. Commonly used keywords are uppercase.

Advantages and disadvantages of pseudocode

Advantages of pseudocode

  • It is a language independent, Pseudocode can be used by most programmers allowing developers to express designs in simple and natural language.
  • It is easier to develop software from Pseudocode than from flowcharts. Programmers don’t have to think about the syntax, we just have to focus on the underscore logic. The focus is on the steps to solving the problem rather than how to use computer language.
  • It is often easy to translate Pseudocode into a programming language.
  • The use of words and phrases in Pseudocode, which are in the line of basic computer operations, simplifies the translation of Pseudocode algorithms into specific programming languages.
  • Unlike flowcharts, Pseudocode uses a simple and easy to read syntax which makes it easy to modify.
  • Pseudocode allows programmers to work in multiple computer languages. Pseudocode can be easily checked by more different combinations than actual code.

False code defects

  • It does not provide a visual representation of the programming logic.
  • There is no accepted standard for writing Pseudocode. Programmers use their style of writing Pseudocode.
  • Pseudo-code cannot be compiled or executed and there is no real syntax syntax. This is just one step, and it is an essential step, in creating the final code.

False code example

Here are some examples of pseudocode, which of course you can use as a reference to learn pseudocode.

Example of entering a false code of the preferred color

START
PROGRAM getColor
Create variable Color
Tanyakan warna favorit pengguna kepada pengguna
READ INPUT into Color
PRINT Color
END

Example of pseudo code Calculating circumference of a circle

START
NUMBER r, perimeter 
INPUT r 
perimeter=2*3.14*r
OUTPUT perimeter
END

Example of adding a false symbol for two numbers

START
NUMBER s1, s2, sum
OUTPUT("Input number1:")
INPUT s1
OUTPUT("Input number2:") 
INPUT s2
sum=s1+s2
OUTPUT sum
END

Example of a pseudocode for a parameter program

START
Read bil_bulat
IF bil_bulat mod 2 = 0,
THEN write “bilangan genap”
ELSE write “bilangan ganjil”
END

Example of pseudocode printing numbers from 1 to 100

START
NUMBER counter
FOR  counter = 1 TO  100 STEP 1 DO
     OUTPUT counter
ENDFOR
END

conclusion

So what is a Pseudocode? Pseudocode is an informal way of describing programming that does not require the formulation of a formal programming language or consideration of underlying technology. Pseudocode or pseudocode is used to create an outline or rough concept of the program.

The goal is to make it easier for humans to understand compared to using commonly used programming languages, especially since the succinct and non-system dependent aspects are the basic principles of the algorithm.


Lots of articles What is Pseudocode: Definition, Examples, Functions and Structures. Look forward to other interesting articles and don’t forget to share this article with your friends. Thank you…

Leave a Comment

/* */