Much better! Not only is that fewer lines of code with less repetition, this would be the same length no matter how many elements we were iterating through!
The while
loop will run the code in the block while the condition in ()
is true
.
Nope, that's not right!