C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet125/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   121   122   123   124   125   126   127   128   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

x

 to 


x

 and assigns this result to 



y

. The value of 



x

 is incremented 

after its value has been obtained. However, the statement

y = x + ++x;

obtains the value of 

x

, increments 



x

, and then adds that value to the original value of 



x

.

The result is assigned to 



y

. As the output shows, simply changing 



++x

 to 


x++

 changes the 

number series from even to odd.

www.freepdf-books.com




PART I

C h a p t e r   4 :  

O p e r a t o r s  

67

PART IPART I



One other point about the preceding example: Don’t let expressions like

x + ++x


intimidate you. Although having two operators back-to-back is a bit unsettling at first 

glance, the compiler keeps it all straight. Just remember, this expression simply adds the 

value of 

x

 to the value of 



x

 incremented.



Relational and Logical Operators

In the terms 



relational operator

 and 


logical operator, relational

 refers to the relationships that 

values can have with one another, and 

logical

 refers to the ways in which true and false values 

can be connected together. Since the relational operators produce true or false results, they 

often work with the logical operators. For this reason they will be discussed together here.

The relational operators are as follows:

Operator


Meaning

= =


Equal to

!=

Not equal to



>

Greater than



<

Less than

>=

Greater than or equal to



<=

Less than or equal to

The logical operators are shown next:

Operator


Meaning

&

AND



|

OR

^



XOR (exclusive OR)

||

Shor t-circuit OR



&&

Shor t-circuit AND

!

NOT


The outcome of the relational and logical operators is a 

bool

 value.


In general, objects can be compared for equality or inequality using 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   121   122   123   124   125   126   127   128   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish