Introduction to while loops


This is my first post and I hope I'm posting correctly - this layout is a little confusing.
Q: Why does this lessons while loop need to be in a function? Why can't var count = 0 be by itself outside the while loop. What purpose does the function(count < 3) serve that the (count) couldn't do on it's own?Thanks!


Hi - @mtf gave a great explanation of this:


Than You for the link!


Could you provide the code you've wrote? Because this:

function(count < 3)

is definitely not working.