Assignment in PSeInt: what the <- arrow means
Stores a value in a variable. Read the arrow <- as "gets": the right side is worked out first and the result goes into the box on the left, replacing whatever was there.
- Group:
- Structures
- Template
Asignar
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 puntos <- 10 puntos <- puntos + 5 Escribir puntosFinAlgoritmoOutput
puntos ends up as 15.
This is what the console shows when the example runs.
15Common mistake
It isn't a maths equation: puntos <- puntos + 5 means "add 5 to puntos".
Good to know
Besides <-, := is accepted too. Some profiles also let you assign with =, but <- avoids mixing it up with a comparison.
Some details depend on your school's profile. See the language profiles.
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.
<variable> <- <valor>Examples that use it
Programs from the example library where it appears, from the simplest to the most complete.
Temperature Converter
Converts degrees Celsius to Fahrenheit and Kelvin.
BeginnerTip Calculator
Splits a restaurant bill, tip included.
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.
BeginnerPassword Check
Keeps asking for a password until it has at least 8 characters.
BeginnerCountdown
A rocket launch countdown that ticks second by second.
Beginner
More structures
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.