The pseudocode examples
In this section, we will look into a few code examples for pseudocode.
Hello world in pseudocode
The first example will be a short program that just prints Hello, World! to the screen.
In our pseudocode, it will look like this:
print "Hello, World!"
Variables declaration in pseudocode
In this example, we will create a couple of variables. The first one will store an integer. The second one will store the value from the first one but converted into a string:
my_int_value = 10 my_string_value = string(my_int_value)
The for loop in pseudocode
In this example, we will have a for
loop that iterates 10 times and prints the values 0
to 9
:
for i = 0 to 10 print i end_for
Functions in pseudocode
In this example, we will create a small function that will accept three integers as arguments. The function should then return the largest of them. We will also call the function and display the result.
...