(#3)(coding tutorial) Let's become a pseudo code programmer FIRST (Don't worry, not pseudo coder too long)
Hi, this is next article in coding tutorial, check last article to be ready for this portion of probably new knowledge :)
So, for now we are brave cook, but not in the kitchen, but in front of our device. What now? For now We now how to create a recipe and we know how to read, and follow instructions in this recipe. Now we want to explain this recipe to our computer. So to do this, You need to explain every step one by one and also you need to tell every action which should happen line by line.
But don't worry, You and I will try to explain it in very simple english, but we'll have to use some keywords. Keywords means some words which will mean one exact thing which we will make on our own. So we make a dictionary for our pseud language? Well, kinda yes. Ok, so now I'm going to show you how to make such dictionary and use it in our imaginary/pseudo computer.
First, I will explain it using english sententences and then I will put everyting in short form using table.
What we want first is to be able to show anything to our virtual monitor. Let's make first keyword "show".
"show" keyword can be linked with a sentence in double qoutes "" or just a number like -2,-1,1,2,3.
Next keyword is "get" would be used to get something from us.
Next useful keywords would be "start" and "stop". Well it's self explanatory - we just want to know where we want to begin and where we want to end our code so our virtual pseudo computer knows where to start and stop.
Another very useful keyword would be "if". "if" keyword is useful when we want to compare two things in our code. We can check if something identical or something is different, or something is bigger, or something is smaller than second object. That object can be in container or it can be number, sentence/word/letter in double quotes "", etc. keyword "if" creates alternative choice. It's hard to read code when there are many "if" keywords so use it wisely.
Last keywords will be math keywords "add"(+), "subtract"(-),"is bigger than"(>),is smaller than(<),"is equal to"(==)
Pretty complicated, huh? Not that much, let's see table of keywords with example instruction for our future pseud code.
| keyword | example use of keyword | result |
|---|---|---|
| show | show "Hello coder" | it should show to our virtual monitor text "Hello coder" |
| start | start | begin our code to run |
| stop | stop | end running code and exit |
| get | get number a | put number to a box "a" which you will use later |
| add | add a to b | get value inside box "a" and add it to value inside box "b" |
| subtract a from b | get value from box "a" and subtract it from value inside box "b" | |
| is bigger than | a is bigger than b | we check if value from box "a" > value from box "b" |
| is smaller than | a is smaller than b | we check if value "a" < value "b" |
| is equal to | a is equal to b | we check if value "a" is the same as value "b" |
| if (yes) then (action) else (other action) | if a is bigger then b then show "hi" else show "bye" | we decide if the answer is true(yes) or answer is false(no). When you decide in code there are two choices to make. if (yes) then do first choice, if (no) else do (other action) |
Ok, now lets make our first code on left and produce equivalent on the right side
first pseudo code will add any 2 numbers. So it looks like this:
TITLE: Program to get result of adding two different numbers
| line | code | input/output/result |
|---|---|---|
| 1. | START | begin program |
| 2. | get number a | I click number 5 from keyboard and store it to a |
| 3. | get number b | I click number 7 from keyboard and store it to b |
| 4. | show add number a to number b | count 5+7 and show result number 12 |
| 5. | STOP | end program |
I hope it wasn't scary. Let's make something more difficult.
TITLE: Program to check if two numbers are the same
| line | code | input/output/result |
|---|---|---|
| 1. | START | begin program |
| 2. | get number a | I click number -2 from keyboard and store it to a |
| 3. | get number b | I click number 3 from keyboard and store it to b |
| 4. | if a is equal to b then show "numbers are the same" else show "numbers are different" | I see if number -2 is the same as number 3 and show result text "number are different" |
| 5. | STOP | end program |
While writing this post I realised how hard is to make your own programming language and explain it in simple, but I hope that I gave you a hint how many methods there are to find a result. Whether it's pseudo code or real programming language.
Next article is going to give some more practice. Now it's going to be a real deal. We are going to learn some real programming languages. Neat. I code in Java and some Javascript. We are going to use one of language.
Hope you learned something :)
Stay tuned for next article.
Leave (#3)(coding tutorial) Let's become a pseudo code programmer FIRST (Don't worry, not pseudo coder too long) to:
Read more #hive-181450 posts
Best Posts From Grzegorz
We have not curated any of grzegorz2047's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Grzegorz
- MY photos from Switzerland trip last year
- Czym jest platforma huggingface z projektami AI i jak można z niej korzystać?
- Pictures during my trip through Tatra mountains, Poland
- Jak wystawić za darmo swoje backendowo REST API na render.com
- Selected pictures from my trip through Europe
- What is a NFC tag and how can YOU use it (cheaply)
- Jak praktycznie użyć tagów NFC w życiu codziennym
- Hive tools #2 - Python Bot to vote on favorite author's comments
- Automat do głosowania na komentarze użytkownika
- Jak skonfigurować darmowego bota auto.vote do automatycznego głosowania
- Stworzyłem nowe narzędzie do znajdowania mocno wspierane treści
- How to use chatGPT and DALL-e through microsoft copilot and translate text using DeepL for Free
- (#6)(coding tutorial) How to create and run javascript code and how to use variables
- (#1) Hive tools - Tutorial how to make simple interface to read our blog posts
- (#5)(coding tutorial) To become programmer, we need to learn to count or do simple math again (I'll show you why)
- (#4)(coding tutorial) Let's dive deep into a real programming language (Javascript)
- Exploring Hive cosystem
- How to log in for the first time to Windows 11 without Microsoft account
- (#3)(coding tutorial) Let's become a pseudo code programmer FIRST (Don't worry, not pseudo coder too long)
- (#2)(coding tutorial) How to cook a program algorithm using our recipe