VBScript: Functions and Loops - The For Each...Next Loop
(Page 4 of 6 )
The For Each...Next loop will iterate a block of code for every item or element in a collection or array:
<html>
<body>
<script type="text/vbscript">
dim lame(2)
lame(0) = "I"
lame(1) = "Hate"
lame(2) = "Huckabees"
for each x in lame
document.write(x & "<br />")
next
</script>
</body>
</html>
The result of this magnanimous code is:
I
Hate
Huckabees
Next: Do Loop >>
More BrainDump Articles
More By James Payne