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.
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.
+ 1
Thank you so much brother bahha