+ 1
Need a clear idea about Boolean. What is it? Why? and how it is used?
Boolean
6 Answers
+ 9
Boolean refers to the value of 1/0 or True/False. This data type is used for simple flags that track true/false conditions.
+ 5
It is declaring a boolean variable online with value true. Online can only be true or false. Hence, boolean variable is used.
+ 2
Booleans are usually used with if/else statements to evaluate if a certain state is true or not:
if(online == true) {
puts("You're online");
} else {
puts("You're offline");
}
+ 1
Arushi Singhania can you please elaborate the following code?
"boolean online = true"
Please elaborate a little more.
0
think of it outside the coding it shall become clear. a two state condition. the light switch is on of off, the shoelace tied or untied? the coffee use milk or black without, sweet with sugar or none. left or right up or down. matter or anti matter. George Boole who these things are named after gave us Boolean Algebra and was largely self taught. do a bit of research into him his work it all becomes clearer
- 1
no