I am new to programming and currently learning Java from Stanford free learning course. There was this assignment that I had trouble translating my algorithm into code. I feel like I have a misconception about nested loops.
My question in this code:
while (frontIsClear()) { //LET THIS REFER AS BOOLEAN 1
putBeeper(); //LET THIS REFER AS STAT 1
if (frontIsClear()) { // LET THIS REFER AS BOOLEAN 2
move(); //LET THIS REFER AS STAT 2
}
}
If BOOLEAN 1 is TRUE but BOOLEAN 2 is FALSE then will STAT 1 work or will it terminate everything?
I understand STAT 2 won't work because BOOLEAN 2 is false but I just don't get this loop inside condition etc.