Pseudocode helps you design program logic without worrying about syntax. Learn variables, conditionals, and loops with a practical example.
Introduction to Pseudocode and Programming Logic

Before programming in any language, it’s worth mastering logic first: variables, conditionals, and loops. Pseudocode is the ideal tool to practice without being tied to a specific language’s syntax.

What is pseudocode?

Pseudocode is a way to describe an algorithm using a language that sits between natural speech and programming code. It doesn’t belong to any specific language (Python, Java, etc.); instead, it expresses the logic in a clear, structured way. It’s widely used in education to learn how to think like a programmer before writing real code, and also in the early design stage of programs.

PSeInt: a pseudocode editor and interpreter

PSeInt (Pseudo Interpreter) is a free program that lets you write, run, and debug pseudocode (commonly in Spanish). It’s ideal for beginners.

How to use it: download PSeInt from pseint.sourceforge.net, install it, and open a new file. Write your algorithm, save it with the .psc extension, and press Run (or F9). The program will execute step by step, and you’ll be able to see variable values in the console.

Variables and data types

In pseudocode, we declare variables with Definir and a type: Entero, Real, Caracter, etc. For example:

Definir horasModulo Como Entero;
Definir notaModulo Como Real;
Definir clasificacion_nota Como Caracter;

Loops: Mientras

The Mientras ... Hacer ... FinMientras loop repeats a block while a condition is true:

Mientras numModulos <> 0 Hacer
    Leer horasModulo;
    Leer notaModulo;
    resultado <- resultado + (horasModulo * notaModulo);
    hTotal <- hTotal + horasModulo;
    numModulos <- numModulos - 1;
FinMientras

Conditionals: Si / SiNo

Si/SiNo structures let you branch your logic based on a condition. They can be nested:

Si resultado / hTotal >= 9 Entonces
    clasificacion_nota <- "Excellent";
SiNo
    Si resultado / hTotal >= 7 Entonces
        clasificacion_nota <- "Notable";
    SiNo
        Si resultado / hTotal >= 5 Entonces
            clasificacion_nota <- "Satisfactory";
        SiNo
            clasificacion_nota <- "Not passed";
        FinSi
    FinSi
FinSi

Complete example: weighted average calculation

A typical script computes a weighted average of grades across modules and labels the result (excellent, notable, satisfactory, not passed). The same logic can later be translated to Python, Java, or any other language.