-->

What is Pseudocode: Definition, Examples, Functions, and Structure

What is Pseudocode: Definition, Examples, Functions, and Structure

What is Pseudocode: Definition, Examples, Functions, and Structure


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


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


It can be a challenge if you are a new coder to think like a programmer from the start. Translate app ideas to actual code takes some practice.


To bridge the gap between what you want your app to do and the code you need to write, you can use pseudocode.



Definition of Pseudocode


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


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


Even though it is not written in a programming language, there are still keywords used that refer to common coding concepts. Writing Pseudocode also has no definite rules but must be logical. It is written in uppercase to make it easier to read. Here are suggestions for writing Pseudocode:

1. Use capital letters for command codes such as (IF, ELSE, and THEN).

2. Each statement is written in one line.

3. Using indents.

4. Specific.

5. Simple.


Pseudocode function


Pseudocode helps you plan your application before you write it. This helps you create algorithms in a more readable format than code syntax. Once programming languages came around, it became more difficult to understand what your code was doing.


Writing Pseudocode also allows you to get good ideas in your head without having to worry about programming language syntax. Because it has no specific syntax, these programs are 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 were interviewed to be a software engineer, they wouldn't expect you to memorize syntax. 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 to solve problems systematically and sequentially.

* Pseudocode is used to write algorithms.

* Pseudocode contains a series of processes to solve problems.

* The language used is more concise and easy to understand.

* There are no standard rules for writing Pseudocode.


Pseudocode structure


Generally, in writing Pseudocode it is divided into three structures or parts, namely:

1. Title - Generally the title begins with writing "PROGRAM" which is then followed by the name of the algorithm.

2. Declaration – This section is the variable that belongs to the algorithm is declared. This variable can be an integer, a fraction, a character, a boolean, and so on.

3. Algorithm - This is the section that contains a set of algorithm commands. Algorithm commands can be iterative, conditional or sequential.


Important Points In Writing Pseudocode


1. Pseudocode will be attached by START (or BEGIN) and STOP (or END).

2. Pseudocode should be concise so ignore unnecessary details.

3. To receive data from users, commonly used statements are INPUT, READ, GET, or OBTAIN.

4. To display any result or message, commonly used statements are PRINT, DISPLAY, or WRITE.

5. The commonly used keywords are capital letters.


Advantages And Disadvantages Of Pseudocode


Advantages of Pseudocode


* It is language independent, Pseudocode can be used by most programmers thereby enabling developers to express designs in a simple and natural language.

* It is easier to develop programs from Pseudocode compared to flowcharts. Programmers don't have to think about syntax, we just have to concentrate on underscore logic. The focus is on steps to solve a problem rather than how to use computer language.

* It's often easy to translate Pseudocode into a programming language.

* The use of words and phrases in Pseudocode, which is in the basic lines of computer operations simplifies the translation of Pseudocode algorithms into specific programming languages.

* Unlike flowcharts, Pseudocode uses a simple and readable structure making it easier to modify.

* Pseudocode allows programmers to work in multiple computer languages. Pseudocode can be inspected more easily by various groups than actual code.


Disadvantages of Pseudocode


* Does not provide a visual representation of programming logic.

* There is no accepted standard for writing Pseudocode. Programmers use their own Pseudocode writing style.

* Pseudocode cannot compile or execute and there is no real formative of the rule syntax. This is just one step, which is important, in generating the final code.


Pseudocode example


The following are some examples of pseudocode, which of course you can use as a reference for learning pseudocode.


Pseudocode Example of Entering Favorite Color


START

getColor PROGRAM

Create variable Color

Ask the user's favorite color to the user

READ INPUT into Color

PRINT Color

END


Pseudocode Example of Calculating the Circumference of a Circle


START

NUMBER r, perimeter

INPUT r

perimeter=2*3.14*r

Perimeter OUTPUT

END


Example of Pseudocode Addition of Two Numbers


START

NUMBER s1, s2, sum

OUTPUT("Input number1:")

INPUT s1

OUTPUT("Input number2:")

INPUTs s2

sum=s1+s2

OUTPUT sum

END


Modulus Program Pseudocode Example


START

Read bil_bulat

IF bil_bulat mod 2 = 0,

THEN write "even number"

ELSE write "odd number"

END


Pseudocode Example Printing Numbers 1 To 100


START

NUMBER counter

FOR counter = 1 TO 100 STEP 1 DO

OUTPUT counters

ENDFOR

END


Conclusion


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


The goal is to make it easier for humans to understand compared to using programming languages that are commonly used, especially its aspects that are concise and do not depend on a particular system are the main principles in an algorithm.

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ________


So many articles What is Pseudocode: Definition, Examples, Functions, and Structure. Look forward to other interesting articles and don't forget to share this article with your friends. Thank you…


Resa Risyan


Just an ordinary person who wants to share a little knowledge, hopefully the knowledge I provide can be useful for all of us. Keep in mind! Useful knowledge is an investment in the afterlife.


Also, read the article about What are PWAs (Progressive Web Apps). And see you in another article. Bye
Read Also :
DotyCat - Teaching is Our Passion