PSeInt pseudocode reference
Each word of the language has its own page: what it does, a complete example with the output it prints, the most common mistake and how it looks in a flowchart.
The examples use PSeInt's syntax, which is in Spanish, and were checked by running them in Codoritmo, a free editor that works in the browser. Open any of them with one click and change it.
Structures
The instructions an algorithm is built from: reading and showing data, deciding, repeating and splitting a program into parts.
- DefinirDeclares one or more variables and assigns their data type with Como.
- DimensionSets the size of one or more arrays after they have been declared.
- EscribirWrites one or more values to the output console and advances to the next line.
- Escribir Sin SaltarWrites without adding a newline, useful for prompts and progressive output.
- LeerPauses execution until the next entered value is submitted, then stores it in the target variable.
- Assignment (<-)Writes a value into a variable or array element.
- Si Entonces (if)Adds a conditional block with an explicit true branch.
- Si / SiNo (if-else)Adds true and false branches in the same conditional block.
- Segun (switch)Adds a multi-branch selection block with one case and a default path.
- Mientras (while)Repeats the body while the condition remains true.
- Repetir Hasta Que (do-until)Repeats until the condition becomes true.
- Repetir Mientras Que (do-while)Repeats while the closing condition remains true.
- Para (for)Adds a counted loop with start and end values.
- Para Cada (for each)Iterates over each element of a collection when that profile setting is enabled.
- Limpiar PantallaClears the output console before the next writes appear.
- EsperarPauses execution for a duration expressed in seconds or milliseconds.
- Esperar TeclaPauses execution until the user continues with a key action.
- SubProcesoCreates a reusable routine with optional by-reference parameters.
- SubAlgoritmoCreates an alternate routine header using the same browser engine support as SubProceso.
- Funcion (function)Creates a function routine that can return a named result.
- Retornar (return)Returns a value from the current function or routine flow.
Algebraic
Arithmetic: addition, subtraction, multiplication, division, powers and the remainder of a division.
- Addition (+)Adds two numeric expressions or concatenates text when that setting is enabled.
- Subtraction (-)Subtracts the right expression from the left one.
- Multiplication (*)Multiplies two numeric expressions.
- Division (/)Divides the left expression by the right one.
- Power (^)Raises the left expression to the exponent on the right.
- MOD (%)Returns the remainder of an integer division.
Logical
To combine conditions or flip them.
Relational
To compare two values. They always answer true or false.
- Equal (=)Checks whether both values are equal.
- Not equal (<>)Checks whether the two values differ.
- Less than (<)Checks whether the left value is smaller than the right one.
- Less or equal (<=)Checks whether the left value is smaller than or equal to the right one.
- Greater than (>)Checks whether the left value is greater than the right one.
- Greater or equal (>=)Checks whether the left value is greater than or equal to the right one.
Math Functions
Ready-made functions for absolute values, rounding, square roots and random numbers.
String Functions
Functions to measure, cut, join and convert text.
Constants
Values the language already knows.
Codoritmo is an independent, open-source project inspired by PSeInt and compatible with its syntax. It is not affiliated with the PSeInt project. Official PSeInt website.