开发者

Reasons for inconsistent VB.NET syntax?

Does anyone know if there's any particular reaso开发者_JAVA技巧n 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?


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.


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

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜