views:

66

answers:

3

Does anyone know if there's any particular reason that VB.NET construct syntax isn't consistent? For example:

If
...
End If

Select
...
End Select

You'd assume it would be for... end for, while... end while ... but instead we have:

While
...
Wend

For
...
Next

This has mildly frustrated me for a while, and I just got to wondering whether there was any conscious decision behind it. Or was it just an initial not-so-well-thought-out design decision that can no longer be changed because of backwards compatibility problems?

+1  A: 

You can use while/end while.

For/next makes sense to me, but that may be because I'm used to it.

These language terms have been in use in several older variants of Basic for years. I assume that is why MS chose to use them.

Brad
+4  A: 

The While construct has actually gotten more consistent since VB 7. It's now End While instead of Wend.

The reason for the inconsistent Next is mostly historical. It's been that way in BASIC since the first version, more than 40 years ago.

Guffa
cool! does that mean Wend is deprecated?
froadie
@froadie: No, if it was deprecated it would still work, it's simply replaced. The compiler still regognises it though, and if you try to use it you get a specific error message that it's replaced.
Guffa
+2  A: 

In older versions, the Next keyword required a variable name (eg, Next n).

It wouldn't make sense to write End For n.

SLaks