Skip to content
EspañolWorkspace →

Colloquial conditions in PSeInt: Es Par, Es Multiplo De…

1 example

How it works

PSeInt lets you write some conditions almost the way you'd say them in Spanish: n Es Par (is even), n Es Impar (is odd), n Es Positivo, anio Es Multiplo De 4, a Es Mayor Que b, x Es Igual A 0. They can be negated too: n No Es Par.

Each one is the same as an ordinary comparison: n Es Par is n MOD 2 = 0, and a Es Mayor Que b is a > b. They let you read the code out loud and get it the first time.

These phrases depend on the profile: some courses turn them off so you practise with the operators. If your profile doesn't accept them, write the equivalent comparison.

Short example

The least you need to see it work. Copy it or open it in the editor.

colloquial-conditions.psc · 14 lines
Algoritmo Colloquial    Definir n Como Entero    Escribir "Type a number:"    Leer n    Si n Es Par Entonces        Escribir n, " is even"    FinSi    Si n Es Multiplo De 5 Entonces        Escribir n, " is a multiple of 5"    FinSi    Si n Es Mayor Que 100 Entonces        Escribir n, " is greater than 100"    FinSiFinAlgoritmo

What it prints:

Type a number:User answer: 4040 is even40 is a multiple of 5
Open it in Codoritmo

Opens in the browser editor, nothing to install.

Solved exercises

Each exercise comes with the full code, its flowchart and a sample run.

  • Leap Year

    Applies the calendar rules to tell whether a year is a leap year.

    Intermediate

In the language reference

The instructions involved, explained one by one.

Other concepts

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.