Skip to content
EspañolWorkspace →

PSeInt Y operator (and): when both conditions must hold

Joins two conditions and is true only when both are. Think "I need this and also that".

Group:
Logical
Template
Y
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.

and-operator.psc · 3 lines
Algoritmo Example    Escribir (5 > 3) Y (2 > 8)FinAlgoritmo

Output

Shows: FALSO (the first is true, but the second isn't)

This is what the console shows when the example runs.

FALSO

Common mistake

Real use: edad >= 13 Y edad <= 19 is true only for teenagers.

Good to know

Instead of Y you can write &&. The symbol works in every profile; the word Y works in profiles that allow word operators, like the default one.

Some details depend on your school's profile. See the language profiles.

In a flowchart

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

edad >= 13 Y edad <= 19Sí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 "edad >= 13 Y edad <= 19"; 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.

Y · 1 line
Y

Examples that use it

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

  • Name Initials

    Gets the initials of a full name.

    Beginner
  • 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
  • Bubble Sort

    Sorts random numbers by swapping neighbors, and stops as soon as they're in order.

    Intermediate
  • Insertion Sort

    Inserts each number among the sorted ones, like arranging cards in your hand.

    Intermediate
  • Binary Search

    Finds a value in a sorted array by halving the range every step.

    Intermediate
See every Logic example →

More logical

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.