VBScript: Array Functions - Array Functions
(Page 4 of 6 )
Simply put, array functions allow you to, well...perform functions on arrays. Mind boggling, I know. For starters, we will begin with the most obvious:
The Array Function
The array function takes a list of comma-separated values and stores them in an array. Here it is at work:
dim myArray
myArray=Array(100, 200, 300, 400, 500)
document.write(myArray(1))
This results in the print out:
200
Remember: the first value in an array has the index number 0.
IsArray?
The IsArray function asks whether something is an array. If it is, it returns a Boolean True; if not, it returns a Boolean False. Here is the science:
<html>
<body>
<script type="text/vbscript">
dim super(5)
super(0)="I"
super(1)="Am"
super(2)="Iron"
super(3)="Man"
dim villain
villain="Dr. Doom"
document.write(IsArray(super)) & "<br />"
document.write(IsArray(villan))
</script>
</body>
</html>
And the result:
True
False
Next: UBound and LBound >>
More Windows Scripting Articles
More By James Payne