0% found this document useful (0 votes)
11 views7 pages

Programming Operators:: Relational

Relational operators compare two values to produce a boolean result, indicating relationships such as equality and inequality. They are essential for controlling program flow in conditional statements and loops. Examples include operators like ==, !=, >, <, >=, and <=, which help determine outcomes in programming logic.

Uploaded by

krg8jwxkgv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

Programming Operators:: Relational

Relational operators compare two values to produce a boolean result, indicating relationships such as equality and inequality. They are essential for controlling program flow in conditional statements and loops. Examples include operators like ==, !=, >, <, >=, and <=, which help determine outcomes in programming logic.

Uploaded by

krg8jwxkgv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

PROGRAMMING

OPERATORS:

RELATIONAL

ARNAIS, PRINCESS MAE


WHAT IS RELATIONAL?

RELATIONAL OPERATORS COMPARE TWO


VALUES, PRODUCING A BOOLEAN RESULT
(TRUE OR FALSE). THESE OPERATORS,
SUCH AS ==, !=, >, <, >=, AND <=, DETERMINE
RELATIONSHIPS LIKE EQUALITY,
INEQUALITY, AND RELATIVE MAGNITUDE.
RELATIONAL OPERATORS ARE
FUNDAMENTAL FOR CONTROLLING
PROGRAM FLOW WITHIN CONDITIONAL
STATEMENTS AND LOOPS.
OPERATORS
TABLE
OPERATOR DESCRIPTION EXAMPLE RESULT

== EQUAL TO 5 == 10 FALSE

!= NOT EQUAL TO 5 != 10 TRUE

> GRETER THAN 5 > 10 FALSE

TRUE
< LESS THAN 5 < 10

>= GRETER THAN OR EQUAL TO 5 >= 10 FALSE

LESS THAN OR EQUAL TO 5 <= 10 TRUE


<=
USING RELATIONAL OPERATORS
IN IF-ELSE

CONDITIONAL STATEMENTS, SUCH AS IF AND


ELSE, USE THESE BOOLEAN RESULTS TO CONTROL
WHICH CODE BLOCKS EXECUTE. FOR EXAMPLE, IF
(AGE >= 18) USES THE >= RELATIONAL OPERATOR TO
DETERMINE VOTING ELIGIBILITY.
LOOPS

IMAGINE A LOOP AS A DILIGENT WORKER THAT REPEATEDLY


EXECUTES A SET OF INSTRUCTIONS. BUT LIKE ANY GOOD
WORKER, IT NEEDS TO KNOW WHEN TO STOP. THIS IS WHERE
RELATIONAL OPERATORS COME IN. THEY ACT AS THE "DECISION-
MAKERS" WITHIN THE LOOP, DETERMINING WHETHER THE
WORKER SHOULD CONTINUE ITS TASKS OR TAKE A BREAK.
TRUE OR FALSE

1. 8>=5
2. 2!=9
3. 10<3
4. 6==6
5. 5>4
THANK YOU

WARNER & SPENCER MARCH 2023

You might also like