One of my students wrote this program to count up to 5, which I did not expect to work. I believed the target value of x would be overwritten with 0 when the loop begins, so the loop would either not start or run infinitely. Could someone please tell me what is going on behind the scenes?
Dim x As Integer
x = 5
For x = 0 To x
MsgBox(x)
Next x