Apart from a conditional statement how else can we use Boolean values? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Apart from a conditional statement how else can we use Boolean values?

1st Mar 2021, 2:51 PM
Global Universe
Global Universe - avatar
3 Answers
+ 3
As condition in loops, also as function arguments, where boolean expression is expected.
1st Mar 2021, 3:01 PM
Ipang
0
Hi! the statements in the loop: while(true)
1st Mar 2021, 3:03 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
usually, boolean are used as 'flag', to reflect 2 states: you can use boolean for anything requiring 2 states: true/false is the most obvious, but it could be any two states that you need... a common example is the <input type="checkbox"> (or 'radio'), wich have a boolean property 'checked' whose 2 states are checked/unchecked ;)
1st Mar 2021, 3:45 PM
visph
visph - avatar