C# 0 The Complete Reference


Short-Circuit Logical Operators



Download 4,07 Mb.
Pdf ko'rish
bet129/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   125   126   127   128   129   130   131   132   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

Short-Circuit Logical Operators

C# supplies special 



short-circuit

 versions of its AND and OR logical operators that can be 

used to produce more efficient code. To understand why, consider the following. In an AND 

operation, if the first operand is false, then the outcome is false no matter what value the 

second operand has. In an OR operation, if the first operand is true, then the outcome of the 

operation is true no matter what the value of the second operand. Thus, in these two cases 

there is no need to evaluate the second operand. By not evaluating the second operand, 

time is saved and more efficient code is produced.

The short-circuit AND operator is 

&&

 and the short-circuit OR operator is 



||

. As 


described earlier, their normal counterparts are 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   125   126   127   128   129   130   131   132   ...   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