C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet95/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   91   92   93   94   95   96   97   98   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

The bool Type

The


bool

 type represents true/false values. C# defines the values true and false using the 

reserved words 

true

 and 


false

. Thus, a variable or expression of type 



bool

 will be one of 

these two values. Furthermore, there is no conversion defined between 

bool

 and integer 

values. For example, 1 does not convert to true, and 0 does not convert to false.

Here is a program that demonstrates the 



bool

 type:


// Demonstrate bool values.

using System;

class BoolDemo {

  static void Main() {

    bool b;

    b = false;

    Console.WriteLine("b is " + b);

    b = true;

    Console.WriteLine("b is " + b);

    // A bool value can control the if statement.

    if(b) Console.WriteLine("This is executed.");

    b = false;

    if(b) Console.WriteLine("This is not executed.");

    // Outcome of a relational operator is a bool value.

    Console.WriteLine("10 > 9 is " + (10 > 9));

  }


}

The output generated by this program is shown here:

b is False

b is True

This is executed.

10 > 9 is True

www.freepdf-books.com



Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   91   92   93   94   95   96   97   98   ...   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