+ 1

What is bool???

Boolean

17th Apr 2017, 2:21 AM
Debojyoti Mandal
Debojyoti Mandal - avatar
5 Answers
+ 15
To add to @Sean's answer, any value assigned to a Boolean variable which is not 0 or false, is automatically evaluated to true.
17th Apr 2017, 2:36 AM
Hatsy Rei
Hatsy Rei - avatar
+ 8
Is the Datatype That have two value true and False (0)(1) Respectively
17th Apr 2017, 3:49 AM
Style Jr.
Style Jr. - avatar
+ 2
A boolean is a data type that can be either true (1) or false (0).
17th Apr 2017, 2:33 AM
DaemonThread
DaemonThread - avatar
+ 2
For example, let's say you have a list of items to buy in a store. When you get your empty cart, the state of all items is initially false (or not picked yet). Once you put the item in the cart, you mark the item as true (already picked). That way, you can easily check the list and see which items were picked and which are yet to pick. Is also used to represent the state of conditions. For example, to check if an item is repeated in a list (count > 1), if time is over in a soccer match, if the value of x solves a given equation...
17th Apr 2017, 2:47 AM
Denis Felipe
Denis Felipe - avatar
0
@Hatsy Rey, you can't assign non-boolean values to bool variable in C# (see the tag). And there is no "automatic evaluation". So, you would get compilation error if you would do something like: bool b = 1; It would be possible to do something like this in C++ if I am not wrong â˜ș
17th Apr 2017, 6:21 PM
Valdemar
Valdemar - avatar