VisualBasic6:微软出品、简单易用,虽然几十年前的,依旧生命顽强,以下简称:VB6
VisualFreeBasic:集合VB6的易用和采用c语言的优点及编程底层操作,VB6高手的进阶语言,以下简称:VFB
变量初始化,当声明一个变量时,B语言会初始化它,数字的为 0 ,字符的为空。
VB6 : Dim a as long '默认初始为 0 而且不可以干预。
VFB : Dim a as long = 100 '可以随意初始为任意值。
其它例题:
DIM a as long = 100*8+99 ‘可以是表达式
DIM a as long = 函数(aaa) '可以是函数返回
数组初始化赋值:
DIM bb(3) as long ={1,2,3,4}
未知数组初始化赋值:
Dim cc(...) as string ={"1","2","3","4","5"}
多维数组初始化赋值:
Dim ee(1 To 2,1 To 5) as long = {{0,0,0,0,0},{0,0,0,0,0}}
自定义类型初始化赋值:
Type mytype
var1 As Double
var2 As Integer
var3 As String
End Type
Dim MyVar(2) As mytype = { (1.0, 1, "Hello"), (2.0, 2, "GoodBye") }
注意:对于模块级,静态或全局变量,初始化值必须是常量表达式。