1.VBS There is only one data type-the variant is similar to a generic type, where specific types are materialized at the time of invocation
2. Declaring variables can be used with the Dim statement, public statement, private statement
Declare multiple variables separated by commas
can also be implicitly declared, and directly written, but not a good way, not recommended
3. Declare the array Dim A (10). Starting from 0.
Dynamic arrays
Dim Answer () Redim Preserve Answer (+)
However, when using ReDim to declare the length, preserve represents the content before saving
4. Solve the problem of Chinese garbled, using ANSI code can
Sub MS () Dim answer Answer=MsgBox(" Chinese! ",1,"Example")End SubMs
The effect is as follows:
5. Create Constants
Const age = 20
6. Array length
UBound: The maximum value of the array index.
LBound: Array index minimum value.
Desire array actual length, should be UBound (array) +1
The 7.VB return value is an array, and the return value is returned by the function name
X=getarr (9)'Call the Getarr procedure to return an array of 10 (0-9) elements and assign a value to x fori =0 to UBound(x)'enumerates the arrays that were just returnedArrstr=arrstr &"Getarr ("& I &")="& X (i) &vbCrLfNextMsgboxArrstr'Show ResultsFunctionGetarr (x)ReDimF (x)'dynamically adjust array size by variable fori =0 toXF (i)=Rnd 'Generate random variablesNextGetarr=f'Array is assigned to the return valueEnd Function
8. Functions can be declared using sub and function, but sub has no return value, and function has a return value
3.VBScript Foundation