Skip to content
EspañolWorkspace →

Checking if two values are equal in PSeInt (=)

Asks whether two values are equal and answers true or false. Used in conditions, as in Si or Mientras.

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

equal-operator.psc · 3 lines
Algoritmo Example    Escribir "Ana" = "ana"FinAlgoritmo

Output

Shows: FALSO (upper and lower case count as different)

This is what the console shows when the example runs.

FALSO

Common mistake

= compares; to store a value in a variable use <-.

Good to know

You can also write == to compare.

In a flowchart

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

clave = "1234"SíNo
Used inside a condition. It has no shape of its own; it's used inside a condition. Flowchart: a decision diamond with the condition "clave = "1234""; 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.

= · 1 line
=

Examples that use it

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

  • Coffee Shop Menu

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

    Beginner
  • Name Initials

    Gets the initials of a full name.

    Beginner
  • Parking Fee

    Charges every started hour, with a daily maximum.

    Intermediate
  • Guess the Number

    Guess a secret number from 1 to 100 in seven tries.

    Intermediate
  • Linear Search

    Finds a name in a list, ignoring upper and lower case.

    Intermediate
  • Store Inventory

    Records the stock of each product and flags what to restock.

    Intermediate
See every Si example →

More relational

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.