Could somebody explain boolean value more clearly? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could somebody explain boolean value more clearly?

the definition in the module is confusing and I can't picture it in the example given in the module. what does it actually do?

4th Aug 2017, 6:03 AM
LN LY
LN LY - avatar
3 Answers
+ 3
There are two boolean values: true and false. As well as the two keywords, statements have a value that is one of these two. For example, 5>2 is true, 3<3 is false, 1==1 is true. You often use these conditions with variables to make code execute if some given conditions are true - all if statements are of the form if (boolean) and the code is executed if boolean resolves to true. How might you allow a user to login to an application? you could say if(userId == "dan" && password == 12345) {code} so the code will only run if the bit before && has a boolean value of true AND the bit after && is true. If either condition is false the if statement will not execute. This is due to the meaning of the boolean operator &&.
4th Aug 2017, 6:28 AM
Dan Walker
Dan Walker - avatar
+ 1
ohhkay thanks man! really appreciate it!
4th Aug 2017, 6:36 AM
LN LY
LN LY - avatar
- 1
Boolean mean True or False
4th Aug 2017, 10:21 AM
Irwin Lopez
Irwin Lopez - avatar