Beheld Basal Software Tutorials - Tutorial Addendum - Arrangement Acknowledgment and Congenital Functions
| |
(Continued from antecedent part...)
Dynamic-Size Arrangement Example
To appearance you how dynamic-size arrangement works, I wrote the afterward example, array_dynamic_size.html:
<html>
<body>
<!-- array_dynamic_size.html
Absorb (c) 2006 by Dr. Yang. http://www.yang.com/
-->
<pre>
<script language="vbscript">
document.writeln("")
Dim aYear()
document.writeln("Check 1: Is aYear an array? " & IsArray(aYear))
aYear(0) = "Jan" Absurdity 1: Cable out of range
iSize = UBound(aYear)+1 Absurdity 2: Basis out of range
ReDim aYear(5)
document.writeln("Check 2: Is aYear an array? " & IsArray(aYear))
aYear(0) = "Jan"
aYear(1) = "Feb"
aYear(5) = "Jun"
ReDim Bottle aYear(11)
aYear(10) = "Nov"
document.writeln("Months in a year:")
For i=LBound(aYear) To UBound(aYear)
document.writeln(" " & i & " = " & aYear(i))
Next
</script>
</pre>
</body>
</html>
Here is the output:
Check 1: Is aYear an array? True
Check 2: Is aYear an array? True
Months in a year:
0 = Jan
1 = Feb
2 =
3 =
4 =
5 = Jun
6 =
7 =
8 =
9 =
10 = Nov
11 =
Note that:
- Output bulletin "Check 1" shows that a dynamic-size arrangement is an arrangement accident if its admeasurement is not set yet.
- Commented out "Error 2" shows that "UBound" can not be acclimated is arrangement s admeasurement is not set yet.
"Array" Action and "For Each" Example
To appearance you how the "Array" action and the "For Each" account work, I wrote the afterward example, array_dynamic_size.html:
<html>
<body>
<!-- array_foreach.html
Absorb (c) 2006 by Dr. Yang. http://www.yang.com/
-->
<pre>
<script language="vbscript">
document.writeln("")
Creating a activating arrangement with the "Array" function
aSite = Array("yahoo", "netscape", "microsoft")
document.writeln("Is aSite an array? " & IsArray(aSite))
document.writeln("Lower apprenticed of aPrime = " & LBound(aSite))
document.writeln("Upper apprenticed of aPrime = " & UBound(aSite))
Resizing the array
ReDim Bottle aSite(8)
aSite(8) = "ibm"
Afterlight arrangement elements
For Anniversary sSite In aSite
sSite = sSite & ".com"
Next
Retrieving arrangement elements
document.writeln("Web sites:")
For Anniversary sSite In aSite
document.writeln(" " & sSite )
Next
</script>
</pre>
</body>
</html>
(Continued on next part...)
|
array, ayear, writeln, document, asite, dynamic, ssite, ubound, check, body>, html>, script, pre>, isarray, error, function, redim, , document writeln, dynamic size, < pre>, pre> <, < body>, body> <, < html>, array function, asite document, & isarray, size array, size html, array dynamic, array &, array dynamic size, array & isarray, asite document writeln, dynamic size array, dynamic size html, script tutorials tutorial, document writeln check, ayear document writeln, & isarray ayear, isarray ayear ayear, basic script tutorials, document writeln &, > document writeln, script language vbscript, following example array, tutorial notes array, example array dynamic, tutorials tutorial notes, < script language, visual basic script, notes array declaration, |
Also see ...
(Continued from antecedent part...)Here is the output: Is aSite an array? TrueLower apprenticed of aPrime = 0Upper apprenticed of aPrime = 2Web sites: yahoo netscape micr
(Continued from antecedent part...)Here is the output: Favorite pets: Dog CatFavorite fruits: Apple OrangeErasing arrays...Pets left:
This affiliate describes:Math FunctionsConversion FunctionsString FunctionsDate and Time FunctionsArray FunctionsMisc. Functions
(Continued from antecedent part...)String FunctionsInStr(sString, sSubString) Allotment the position of the first accident of one cord aural another. The seek begins at the first appear
(Continued from antecedent part...)Misc. FunctionsIsArray(variable) Allotment True if the defined capricious is an arrangement IsDate(variable) Allotment
This affiliate describes:"If" Statements"If" Account Example"Select Case" Statements"Select Case" Account Exampleb
(Continued from antecedent part...)"If" Account ExampleTo advice you accept how "If" statements work, I wrote the afterward the example, condition_if.html: <html>
(Continued from antecedent part...)"Select Case" Account ExampleTo advice you accept how "Select Case" statements work, I wrote the afterward the example, condition_case.html:
This affiliate describes:Data TypesData LiteralsMore on Cord LiteralsNotes and samples in this affiliate are based Beheld Basal 6.0.p
(Continued from antecedent part...)To appearance you some examples of data literals, I wrote the afterward script, data_literal.html: <html><body><! data_literal.html Absorb (c)