Module # 2 - Evaluating Expressions
Module # 2 - Evaluating Expressions
• Variable
Data • Temporary storage of data
• Identifiers – name of variables
Neu5 Ne#u
Valid Invalid
Examples
neu = 5 NeU = 6
•pri nt the value of NEU
_neu nul l
Valid •pri nt the value of neu
5
•pri nt the value of Neu
nul l
Operators
Relational
• - >, <, >=, <=, ==, != 5 > 3 = True; 5 > 5 = False, 5>=5 = True,
5 ==5 = True, 5!=3 = True
Types of Increment ++
Operators Decrement --
Assignment
•= x=5 if (x ==5)
Combined x = 2; y = 3
• x+=y x = x+y x =5
• x-= y x = x-y x = -1
• x*=y x = x*y x =6
• x/=y x = x/y x =1
Z = 5 /2 2.5
=2
Examples
X=5%2
=1
True if ALL statements are
&& TRUE
X = 5; Y=2
char - character