Pseudolanguage reference · PSeInt

PSeInt

This page organizes the pseudocode constructs documented by PSeInt: algorithm structure, data, expressions, control flow, and subprograms. PSeInt profiles can relax some writing rules, so check the profile selected in the reference environment.

Pseudolanguage PSeIntFocus Algorithms in pseudocode

01 · Overview

About PSeInt

PSeInt is an educational environment for writing and running algorithms in pseudocode. Its official reference describes Spanish-language instructions and profiles with more flexible or stricter rules.

The environment can also display algorithms as flowcharts, making sequences, decisions, and loops easier to follow alongside the instructions.

02 · Organization

Algorithm structure

The documented format places instructions between Proceso and FinProceso. Some versions and profiles also accept Algoritmo and FinAlgoritmo. Depending on the profile, statements may require semicolons or be separated by lines.

Proceso Saludo
    Definir nombre Como Caracter
    Escribir "¿Cómo te llamas?"
    Leer nombre
    Escribir "Hola, ", nombre
FinProceso

03 · Data

Variables, types, and assignment

An explicit declaration uses Definir nombre Como Tipo. Assignment evaluates the right-hand expression and stores its result in the variable on the left; the types must be compatible.

TypeUse
EnteroInteger numbers.
RealNumbers with a decimal part.
CaracterCharacters and text.
LogicoVerdadero or Falso.
Definir edad Como Entero
Definir promedio Como Real
Definir nombre Como Caracter
Definir aprobado Como Logico
edad <- 16
promedio <- 8.25
nombre <- "Ana"
aprobado <- Verdadero

Names start with a letter, may continue with letters and digits, and cannot match reserved words. Comments start with //.

04 · Expressions

Operators and functions

CategoryFormsMeaning
Arithmetic+ - * / ^ % MODArithmetic, exponentiation, and integer remainder.
Relational> < = <= >=Comparisons.
Logical& Y | O ~ NOConjunction, disjunction, and negation.

Parentheses change the usual evaluation order. The reference also lists built-in functions such as RC, ABS, LN, EXP, SEN, COS, ATAN, TRUNC, REDON, and AZAR.

area <- base * altura / 2
resto <- numero MOD 2
es_par <- resto = 0
raiz <- RC(numero)

05 · Interaction

Input and output

Leer receives one or more values and assigns them to the listed variables. Escribir displays one or more expressions. Some profiles include output without a line break, such as Escribir Sin Saltar.

Escribir "Enter two numbers:"
Leer a, b
suma <- a + b
Escribir "Sum: ", suma

06 · Decisions

Conditions and selection

Si evaluates a condition; Entonces introduces the true branch and Sino the alternative. Segun selects among several cases and may include De Otro Modo.

Si nota >= 7 Entonces
    Escribir "Aprobado"
Sino
    Escribir "Keep practicing"
FinSi
Segun opcion Hacer
    1:
        Escribir "Start"
    De Otro Modo:
        Escribir "Invalid option"
FinSegun

07 · Repetition

Loops

Mientras checks its condition before each iteration. Repetir runs the body first and checks Hasta Que, so it executes at least once. Para walks a range and can use Con Paso.

Para i <- 1 Hasta 5 Con Paso 1 Hacer
    Escribir i
FinPara
Repetir
    Leer clave
Hasta Que clave = "fin"

Make sure the stopping condition can become true to avoid an infinite loop.

08 · Collections

Arrays and matrices

Dimension declares an array or matrix. Its notation and starting index depend on the active profile, so do not assume the bounds. This example has five positions numbered from 0 through 4:

Definir notas Como Real
Dimension notas[5]
Para i <- 0 Hasta 4 Hacer
    Leer notas[i]
FinPara
Escribir "First grade: ", notas[0]

A second dimension creates a matrix and requires one index per dimension. Check the size and bounds set by the profile before accessing a position. Arrays can also be passed to subprograms when their signature is supported by the profile.

09 · Reuse

Subprograms

SubProceso defines a reusable routine. If it returns a value, the header names the variable that receives the result; otherwise, it performs actions without returning one. Call it by name with arguments in parentheses. Parameters can be inputs or, when the profile supports the form, passed by reference to return changes to the caller.

SubProceso resultado <- Doble(numero)
    resultado <- numero * 2
FinSubProceso
Proceso Principal
    Escribir Doble(6)
FinProceso

Local variables stay within the routine. The reference includes recursive calls, such as a power calculation, and passing arrays as arguments. Prefer value parameters for calculations that should not change the original variable; use references only when a routine truly needs to return a modification.

10 · Combined example

Average and result

Proceso Promedio
    Definir a, b, c, media Como Real
    Escribir "Enter three grades:"
    Leer a, b, c
    media <- (a + b + c) / 3
    Si media >= 7 Entonces
        Escribir "Approved: ", media
    Sino
        Escribir "Keep practicing: ", media
    FinSi
FinProceso

11 · Math library

Built-in functions

The functions below appear in PSeInt's basic reference. Write arguments in parentheses; assign, display, or combine the returned value in another expression.

FormResult
RC(x)Square root.
ABS(x)Absolute value.
LN(x), EXP(x)Natural logarithm and exponential function.
SEN(x), COS(x), ATAN(x)Trigonometric functions.
TRUNC(x), REDON(x)Integer part and nearest integer.
AZAR(n)Random integer from 0 through n - 1.
Longitud(texto)Number of characters.
SubCadena(texto, inicio, fin)Substring between the specified positions.
Concatenar(a, b)Joins two character strings.
Mayusculas(texto), Minusculas(texto)Converts letters to uppercase or lowercase.
Definir radio, area Como Real
radio <- 3
area <- 3.14159 * radio ^ 2
Escribir "Area: ", REDON(area)
Escribir "Die: ", AZAR(6) + 1
Definir frase, minuscula Como Caracter
frase <- "Hola, mundo!"
minuscula <- Minusculas(frase)
Escribir "Characters: ", Longitud(minuscula)
Escribir "Start: ", SubCadena(minuscula, 1, 3)
Escribir Concatenar("Text: ", minuscula)

Check the domain of each math function. String operations depend on the profile that enables them. This example starts indexes at 1, so adjust SubCadena to match the active profile.

12 · Writing variants

PSeInt configuration profiles

The selected profile groups the writing options accepted by PSeInt. The official documentation presents Estricto and Flexible as examples of these differences; the program also offers predefined profiles for institutions. The examples illustrate configurations, not a universal list of rules for every class.

AspectEstrictoFlexible
StructureProceso / FinProceso.Algoritmo / FinAlgoritmo.
Data declarationsDeclares variables with Definir and their types.Can infer types from how variables are used.
Statement separatorsThe examples use semicolons.The examples separate statements by line.
Collection traversalPara I <- ... accesses each position by index.Para Cada Elemento de Lista traverses the elements.
ConditionsUses comparisons such as Elemento > ValMayor.Also accepts descriptive forms such as Es Mayor Que and Es Par.
Array dimensionsThe example reserves Dimension Lista[100].The example uses Dimension Lista[Cant].

Option names, array limits, and other constructs depend on the profile actually selected. For class exercises, follow the profile specified by the teacher or course material.

Institutional profiles

PSeInt can provide profiles prepared for universities, faculties, and degree programs. They package the options chosen for a course in one file; availability depends on the list included with the distribution or supplied by the institution.

Create, save, and load a profile

  1. Open Configurar (“Configure”) → Opciones del Lenguaje (perfiles) (“Language Options (profiles)”).
  2. In the profile selection window, choose Personalizar (“Customize”).
  3. Adjust the options to match the conventions the class needs to use.
  4. Use the button with the floppy-disk icon to save the profile to a file; choose where to store it, add a description, and give the file a name that identifies the profile.
  5. To use a shared profile, reopen profile selection, choose Cargar (“Load”), and select the file you received.

After loading it, confirm that the profile is selected before writing or running an algorithm. Sharing the same file helps keep examples in a class under the same rules.

13 · Problem solving

Testing and tracing

Before running an algorithm, identify its inputs, expected result, and conditions that can change its path. Then try simple values whose results you can calculate independently.

  • Test a normal case and boundary values such as zero, one item, and the largest expected input.
  • At each loop, watch the condition, counter, and variables that change.
  • For arrays, verify every index falls inside the declared dimension.
  • For a function, compare its arguments with the returned value and inspect each return path.

The interpreter can trace execution step by step and compare it with a flowchart. A trace helps locate the moment a variable stops matching the expected value; it does not replace choosing useful test cases.

14 · Further reading

References

Return to the Potoo IDE Manual

Explore the other references and project information.

Open the Manual