Skip to content
EspañolWorkspace →

PSeInt Si SiNo (if-else): a decision with two paths

A decision with two paths: one for when the condition is true and another (SiNo) for when it's false. Exactly one of the two always runs.

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

si-sino-if-else.psc · 8 lines
Algoritmo Example    nota <- 75    Si nota >= 60 Entonces        Escribir "Pass"    SiNo        Escribir "Fail"    FinSiFinAlgoritmo

Output

With nota 75 it shows "Pass"; with 40, "Fail".

This is what the console shows when the example runs.

Pass

In a flowchart

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

nota >= minimoSíNo
In the flowchart. Flowchart: a decision diamond with the condition "nota >= minimo"; the Sí (yes) exit continues down and the No exit turns right.
Draw the flowchart of your own algorithm →

Template

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

SiNo · 5 lines
Si <condicion> Entonces  <acciones>Sino  <acciones>FinSi

Examples that use it

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

  • 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
  • Sum Until Zero

    Adds up the numbers you type until you enter a 0.

    Beginner
  • Body Mass Index

    Computes your BMI and classifies it as underweight, normal and so on.

    Intermediate
  • Parking Fee

    Charges every started hour, with a daily maximum.

    Intermediate
  • Leap Year

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

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