+ 5
Java what is while(!(statement))
So im learning Jeroo which is based on java and i need to know what while(!(statement)) is and what it does:D thanks in advance
5 Answers
+ 7
It repeats some code while a condition is false.
So your example code repeats while !(LEFT && RIGHT). Take a look at this diagram: https://code.sololearn.com/WdB8HSffTk3o/?ref=app
+ 5
while(!(bob.isFlower(LEFT) && bob.isFlower(RIGHT)))
Example code
+ 4
Vedant Bang you see i did something so there were 2statements and put individual !'s in front of them but the output was different
+ 2
Emperor Bob evaluate the two conditions separately first.
Their result will be a true or a false.
Now, they have been joined by &&
Hence
true && true = true
true && false = false
false && false = false
+ 1
While (condition is true) {run code}
! is negation operation so
while (!(condition is false)) {run code}