Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

󾠰

Class 03
Expressions

expressions are combinations of operators, constants, and variables (operands).

Types of Expressions:

1. Arithmetic Expressions

2. Relational Expressions

3. Logical Expressions

receiving operand dapat same sa first variable din

Boolean Expression

performing joined statements to check if its true or not.

a logical statement that is either true of false

Class 03 1
boolean expresions can compare data of any type as long as both parts of the
expressions have the same basic data type (relational)

in c, true is any value other than 0, false is 0

1 is true

0 is alwas false

Relational Expression

comparison of one data to another/ one statement to another/ expression to


another.

relational refers to the relationhip value can have with one another.

Class 03 2
Logical Expression

Logical referes to the ways the relationships can be connected

Class 03 3
UNA AN ARITHMETIC, THEN RELATIONAL, THEN LOGICAL

uunahin ang && before ||

Ternary Operations

Ternary operator uses question mark (?) and colon (:) symbols

Syntax: expression1?expression2:expression3;

wherein expression1, expression2 and expression 3 are expressions

expression1 is evaluated

if true, then expression2 is evaluated and become the value of the


expression

else expression3 is evaluated and its value becomes the value of the
expression

Class 03 4

You might also like