For Next Loops


Basic lets you do the following:

For x = 1 To 10
For y = 1 To 10
For z = 1 To 10
‘ Do something
Next z, y, x

Don’t do it. Type out each Next at the appropriate indent level. Some programmers always put the variable name after Next. In fact, many programmers do this with comments even in languages that don’t support it, and they do it for all ending statements, not only Next. For example:

End Function ‘ GetStuff
End Sub ‘ DoStuff
End Select ‘ iChoice
Loop ‘ Do While x
End If ‘ i < 10
End With ‘ oftFirst

I salute this careful coding style, and I wish that I had the self-discipline to follow it myself.