What is pseudocode?

what is pseudocode and how is it used?

Natural language that describes an algorithm. It’s sometimes used to plan out algorithms before implementation, or just describe algorithms without worrying about any specific implementation.

For definitions of common words, Wikipedia and Google are your friends: https://en.wikipedia.org/wiki/Pseudocode


Im going to sound a little bit narcassistic.
Google it :slight_smile:

1 Like

What you’ve described are “comments”. Comments exist inline in actual code and serve to clarify and explain sections of your program.

Pseudocode, in contrast, is not actual code. Instead, pseudocode refers to code-like syntax used to explain an algorithm or syntax in a clearer way than actual code.

Here’s an example of some pseudocode (taken from the Wikipedia article linked above):

void function fizzbuzz {
    for (i = 1; i <= 100; i++) {
        set print_number to true;
        If i is divisible by 3 {
          print "Fizz";
          set print_number to false; 
        If i is divisible by 5 {
          print "Buzz";
          set print_number to false; 
        If print_number, print i;
        print a newline;

As you can see, this is not actual code in any language, but it explains the procedure a program would take without resorting to language-specific or harder-to-understand syntax like if (i % 3 == 0) or printf("%d ", i).