Please can someone explain the use of Booleans in simple words in projects with a project example | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please can someone explain the use of Booleans in simple words in projects with a project example

Related to Booleans

14th Jul 2022, 3:09 AM
Inder Saundh
2 Answers
+ 4
Inder Saundh boolean means true or false In life there might be 2 situation one for 'yes' and one for 'no' so if this is right then 'yes' and if this is wrong then 'no' Same boolean works in programming world. if (true) //print 'yes' else //print 'no' For example a = 10, b = 20 Now we need to get which number is big if (a > b) { cout << "a is bigger than b"; } else { cout << "b is bigger than a"; } Here if (a > b) is true then statement inside 'if' will be print if (a > b) is false then statement inside 'else' will be print
14th Jul 2022, 3:15 AM
A͢J
A͢J - avatar
14th Jul 2022, 6:12 AM
Lothar
Lothar - avatar