Skip to content
EspañolWorkspace →

PSeInt Leer: read input from the user

Pauses the program and waits for the person to type something; whatever they type is stored in the variable. This lets your program work with different data each time.

Template
Leer
Open it in Codoritmo

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.

leer-read-input.psc · 5 lines
Algoritmo Example    Escribir "How old are you?"    Leer edad    Escribir edadFinAlgoritmo

Output

If you type 15, the variable edad becomes 15.

This is what the console shows when the example runs. What the user types is highlighted.

How old are you?User answer: 1515

Common mistake

Use Escribir first to say what you expect; otherwise the person won't know what to type.

In a flowchart

This is how it appears in a flowchart, with the same shapes Codoritmo draws.

Leer edad
In the flowchart. Flowchart: a input parallelogram reading "Leer edad", with one arrow in and one arrow out.
Draw the flowchart of your own algorithm →

Template

The general form. Replace what's inside < > with your own data.

Leer · 1 line
Leer <variable>

Examples 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.

    Beginner
  • Temperature Converter

    Converts degrees Celsius to Fahrenheit and Kelvin.

    Beginner
  • Tip Calculator

    Splits a restaurant bill, tip included.

    Beginner
  • Can I Vote?

    Tells you whether you can vote or how many years you have left.

    Beginner
  • Coffee Shop Menu

    Pick a drink from the menu and get the total to pay.

    Beginner
  • Times Table

    Prints the multiplication table for the number you choose.

    Beginner
See every Input & output example →

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.