How to use boolean type variable in a proper program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to use boolean type variable in a proper program?

25th Jan 2018, 12:12 PM
Alex Hursa
Alex Hursa - avatar
4 Answers
+ 16
here is an example , suppose u want to find prime number , initially boolean b=true; , when n%a==0 ... u can change value of b to false & after the loop if b=true then n is prime , else not prime
25th Jan 2018, 12:42 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
yes
25th Jan 2018, 8:50 PM
Ahmed Zagaoug
Ahmed Zagaoug - avatar
0
$
25th Jan 2018, 12:35 PM
Khairi
0
http://leakyegg.website.tk/RGB.zip I wrote this as my first program.. I made it store and load saved colors with the difference being the position of a switch. That switch runs a boolean variable. Boolean is basically just a switch so it was perfect. Switch set to save position, the variable value is "true" .. Set to load, the variable value is "false"
25th Jan 2018, 2:23 PM
LordHill
LordHill - avatar