A For Each...Next loop repeats a block of code for each item in a collection, or for each element of an array.
Example
<html>
<body>
<%
Dim cars(2)
cars(0)="Volvo"
cars(1)="Saab"
cars(2)="BMW"
For Each x In cars
response.write(x & "<br />")
Next
%>
</body>
</html>
<body>
<%
Dim cars(2)
cars(0)="Volvo"
cars(1)="Saab"
cars(2)="BMW"
For Each x In cars
response.write(x & "<br />")
Next
%>
</body>
</html>
Practice Excercise Practice now