gpt4 book ai didi

vb6 - VB6 中未设置变量的默认值是多少?

转载 作者:行者123 更新时间:2023-12-04 23:32:48 25 4
gpt4 key购买 nike

我正在使用一些旧代码,它定义了一个像这样的全局变量...

Public myvar

此变量从未被赋值,但稍后在测试中使用...

If myvar <> somevalue then
'do something
End If

做某事时 somevalue 的值是多少?

最佳答案

  • 默认值为Empty
  • 对于除 Empty0"" 之外的任何值,"Something will be done"...
    • ... 对于值 Nothing,代码将引发错误并且“某事不会完成”。

来自VB6 documentation

When variables are initialized, a numeric variable is initialized to 0, a variable-length string is initialized to a zero-length string (""), and a fixed-length string is filled with zeros. Variant variables are initialized to Empty. Each element of a user-defined type variable is initialized as if it were a separate variable.

关于vb6 - VB6 中未设置变量的默认值是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4284216/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com