What is the difference between VB and VBScript

后端 未结 6 2128
自闭症患者
自闭症患者 2020-12-15 16:18

What is the difference between VB and VBScript?

6条回答
  •  时光说笑
    2020-12-15 16:52

    This is a very old question, but existing answers are outrageously vague, and/or fail to identify the most important stuff, when they're not just plain wrong. Not going to repeat what other answers already indicate, but the following differences are missing from the other answers:


    Scopes

    VBScript code doesn't need procedure scopes: it can be written as a [drumroll] script that just executes a bunch of procedural operations top-to-bottom.

    In VB6/VBA executable statements can only exist inside procedure scopes.


    Types

    In VBScript everything (variables, function return values, etc.) is a Variant (i.e. pretty much a duck, like in JavaScript). It is illegal to declare an explicit type when declaring a variable. The As keyword is illegal!

    In VB6/VBA everything defaults to an implicit Variant, but good VB6/VBA code uses explicit types where applicable.

提交回复
热议问题