Dim x, y as Date
Run Code Online (Sandbox Code Playgroud)
这两个代码语句有什么区别
Dim x as Date, y as Date
Run Code Online (Sandbox Code Playgroud)
差异的实际结果是什么?我还缺少哪些其他隐藏的声明功能?
Dim x, y as Date
Run Code Online (Sandbox Code Playgroud)
相当于:
Dim x
Dim y as Date
Run Code Online (Sandbox Code Playgroud)
这相当于:
Dim x as Variant
Dim y as Date
Run Code Online (Sandbox Code Playgroud)
当您省略变量的Variant类型时,它假定类型
编辑,根据你的问题:
Dim a! ' same as Dim a as Short
Dim b@ ' same as Dim b as Currency
Dim c# ' same as Dim c as Double
Dim d$ ' same as Dim d as String
Dim e% ' same as Dim e as Integer
Dim f& ' same as Dim f as Long
Run Code Online (Sandbox Code Playgroud)
参考:http : //bytes.com/topic/visual-basic/answers/643371-declaration-shortcuts