ASP/VBScript For Each... Next ใช้ในการแสดงข้อมูล Key และ Value ของตัวแปร Array
Syntax
<%
For Each element In group
[statements]
Next
%>
Sample
<%
Dim arrData(3)
arrData(0) = "a"
arrData(1) = "b"
arrData(2) = "c"
arrData(3) = "d"
For Each arr in arrData
Response.write(arr & "<br>")
Next
Response.write("<hr>")
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("C:\Inetpub\wwwroot\myasp")
Set fc = f.Files
For Each f1 in fc
Response.write f1.name&"<br>"
Next
%>