以下解释来自Rhino Developer Docs
当你在 VBScript 中声明一个变量时,变量之前的值第一个赋值是未定义的,或者 Empty
.
When you declare a variable in VBScript, the variable’s value before
the first assignment is undefined, or Empty
.
Dim varValue ' Empty value
所以基本上,Empty
表示我是一个未初始化的变体".如果你需要检测变量是否实际上是空变体而不是字符串或数字,您可以使用 IsEmpty
.或者,您可以使用TypeName
或 VarType
,但 IsEmpty
最好.
So basically, Empty
says "I am an uninitialized variant." If you need
to detect whether a variable actually is an empty variant and not a
string or a number, you can use IsEmpty
. Alternatively, you could use
TypeName
or VarType
, but IsEmpty
is best.
所以 Empty
用于声明变量.如果声明一个变量,就是在栈上预留存储,但是栈上的 Empty 的值是多少呢?
So Empty
is used for declaring variables. If you declare a variable, you reserve storage at the stack, but what is the value of Empty on the Stack?
VBScript 变量是 Variant
类型.变体表示可以更改类型的值.在内存中,Variant 类型是一个 16 字节的 结构.
VBScript variables are of type Variant
. A variant represents a value that can change type. In memory, the Variant type is a 16 byte structure.
如果变量为空(Empty
值),则 vt
成员(存储变量引用的数据的类型)的值为 0x0000 (VT_EMPTY
)
If the variable is empty (Empty
value), then the vt
member (that stores the type of the data referenced by the variable) will have a value of 0x0000
(VT_EMPTY
)