Skip to content
EspañolWorkspace →

PSeInt Para (for loop): counting loop with an example

Repeats a known number of times. A counter starts at one value, goes up by one (or by whatever you set with Con Paso), and the loop ends once it passes the final value.

Template
Para
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.

para-for-loop.psc · 5 lines
Algoritmo Example    Para i <- 1 Hasta 5 Hacer        Escribir i * 2    FinParaFinAlgoritmo

Output

Shows 2, 4, 6, 8 and 10.

This is what the console shows when the example runs.

246810

Common mistake

Use Para when you know how many rounds; Mientras when it depends on something that happens inside.

In a flowchart

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

Para i ← 1 Hasta 5…
In the flowchart. Flowchart: a Para loop hexagon reading "Para i ← 1 Hasta 5", the body below it and an arrow back to the hexagon on every pass.
Draw the flowchart of your own algorithm →

Template

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

Para · 3 lines
Para i <- <inicio> Hasta <fin> Hacer  <acciones>FinPara

Examples that use it

Programs from the example library where it appears, from the simplest to the most complete.

  • Times Table

    Prints the multiplication table for the number you choose.

    Beginner
  • Countdown

    A rocket launch countdown that ticks second by second.

    Beginner
  • Grade Average

    Stores five grades in an array and finds the average and the highest.

    Beginner
  • Name Initials

    Gets the initials of a full name.

    Beginner
  • Fibonacci Sequence

    Prints the first terms of the Fibonacci sequence.

    Beginner
  • Drawing Shapes

    Draws a square and a triangle with asterisks.

    Intermediate
See every Para 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.