[RESOLVED] Variable Declaration
I know that in VB6
1)
VB Code:
'Incorrect declaration
Dim var1,var2,var3 as string
'var1,var2 will be variant only var3 will be treat as string
'Correct declaration
Dim var1 as String
Dim var2 as String
Dim var3 as String
My question is could we declare like this
VB Code:
Dim var1 as String, var2 as String, var3 as String
I often declare like that cause i'm too lazy to write Dim.
2) In other langugages, variables should be declare at the beginning of the procedure.
However, in VB6 variables can be declare anywhere in the procedure. Is there any inconvernient to this? ( memory loss... or something.)
Like
VB Code:
Dim var1 as String
Dim var2 as String
' Code Here
' Or
Dim var1 as String
' Code Here, We don't declare var2 here since we don't need it at the moment
Dim var2 as String
'Code, now we need it so we declare