0

Why assigning boolean to variable?

I have some confusion about assigning boolean to variable for example: var active = true; Please explain me about this.

25th Mar 2019, 8:00 PM
Hassnain Hussain
Hassnain Hussain - avatar
2 Respostas
+ 3
you could use it to control the flow of your program. for example if you have a loop that runs until you change a boolean variable to false. var ctlr = true; while(ctrl){ //some code if a condition is met ctrl = false; } there are many scenarios where it's useful to use boolean.
25th Mar 2019, 8:17 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
Thank you so much brother bahha
27th Mar 2019, 6:51 AM
Hassnain Hussain
Hassnain Hussain - avatar