For循環

一:<%
'For語句
'語法:
'For 初始變量 to 變量終止值 [step步長]
'執行代碼
'……
'Next
'說明:默認步長值爲1
for i=1 to 5
 'response.Write("第一次循環<br>")
 response.Write("第"&i&"次循環<br>")
 'response.Write(i)
next

%>
二:
<%
for i=1 to 10 step 2
 response.Write(i&"<br>")
next
%>
三:
<%
for i=5 to 1 step -1
 response.Write(i&"<br>")
next '相當於i=i+1
%>
四:
<%
for a=1 to 5 '外層循環
 response.Write("第"&a&"次循環<br>")
 for i=1 to 5'內層循環
  response.Write(i&"<br>")
 next 
next
%>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章