Code:
var i = 0, finished = false;
while( (i < acentos.length) && !finished){
Question:
I have a bool
variable getting false, and in my while
I'm denying it.
If I am denying a false variable, it will true
, correct?
There I am saying, while i
is less than the size of the vector E !finished
for true
, continue?
or
While i
is less than the size of the vector E !finished
is false
continue?
When I put a bool
variable inside a while
, does it ignore the value that was given to it? E defines as true
?.
Complete code below:
var i = 0, finished = false; // <-- *IMPORTANTE
while( (i < acentos.length) && !finished){ // <-- *IMPORTANTE
if (acentos[i] && acentos[i+1] && acentos[i+2]) {
selSeat = i;
//Codigo..
var accept = confirm("Reserva da cadeira "+ (i + 1) +" ~ "+(i + 3)+" está disponível, aceitar?.");
if (accept) {
finished = true; // <-- *IMPORTANTE
}else{
//Codigo..
}
}
i++;
}
My while
is so in the beginning
while(false && true)
When I accept the "accents" and finished
gets true
, then my deny operator denies it, so it stays as false
, so my while
stays like this
while( false && false)
Since the two conditions are the same, does it leave loop ? I may be traveling, but I'm trying to think how logic works.