PSeInt Definir: how to declare variables
Tells the program which variables you'll use and what kind of data each one holds. A variable is like a labelled box: Entero holds whole numbers, Real numbers with decimals, Caracter text, and Logico true or false.
- Group:
- Structures
- Template
Definir
Opens the editor with this example loaded. Run it step by step and watch the flowchart.
Worked example
A complete algorithm, ready to copy and run.
Algoritmo Example Definir edad Como Entero Definir nombre Como CaracterFinAlgoritmoOutput
Creates the boxes edad and nombre, empty until you store something in them.
This example doesn't print anything to the console.
Common mistake
Definir doesn't give the variable a value; use <- or Leer for that.
In a flowchart
This is how it appears in a flowchart, with the same shapes Codoritmo draws.
Template
The general form. Replace what's inside < > with your own data.
Definir <variable> Como EnteroExamples that use it
Programs from the example library where it appears, from the simplest to the most complete.
Personal Greeting
Asks for your name and age, and answers with both.
BeginnerTemperature Converter
Converts degrees Celsius to Fahrenheit and Kelvin.
BeginnerTip Calculator
Splits a restaurant bill, tip included.
BeginnerCan I Vote?
Tells you whether you can vote or how many years you have left.
BeginnerCoffee Shop Menu
Pick a drink from the menu and get the total to pay.
BeginnerTimes Table
Prints the multiplication table for the number you choose.
Beginner
More structures
- Dimension
- Escribir
- Escribir Sin Saltar
- Leer
- Assignment (<-)
- Si Entonces (if)
- Si / SiNo (if-else)
- Segun (switch)
- Mientras (while)
- Repetir Hasta Que (do-until)
- Repetir Mientras Que (do-while)
- Para (for)
- Para Cada (for each)
- Limpiar Pantalla
- Esperar
- Esperar Tecla
- SubProceso
- SubAlgoritmo
- Funcion (function)
- Retornar (return)
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.