This article is mainly to share a little trick about the for loop in ASP. I really don’t pay attention to it at ordinary times. I hope friends who know ASP can refer to it.
The following code is correct and the most common way to write it:
Copy the code code as follows:
<%
dim i
for i=5 to 9
response.write i
next
%>
The following code is wrong and will prompt a missing '=' error:
Copy the code code as follows:
<%
dim i : i=5
for i to 9
response.write i
next
%>
The code below is correct:
[/code]
<%
dim i
i=5
for i=i to 9
response.write i
next
%>
[/code]
In the third piece of code, the key syntax is: i=i, assign the value to yourself to solve the error of missing '='!