1) Exit For
For 카운터 = 시작값 To 종료값 [Step 증가값] 
  [실행구문 블럭] 
  [Exit For] 
  [실행구문 블럭] 
Next

<%

  For counter=1 to 10
      if counter > 4 then
       Response.Write "카운터값이"&counter&"가 되었습니다"
        Exit For
      End if
    Response.Write counter&"번째줄<br>"
  Next

%>


2) Exit Do
Do [{While | Until} 조건문] 
  [실행구문 블럭] 
  [Exit Do] 
  [실행구문 블럭] 
Loop 
<%

  counter=1

  Do While counter < 10
      if counter > 4 then
       Response.Write "카운터값이"&counter&"가 되었습니다"
        Exit Do
      End if
    Response.Write counter&"번째줄<br>"
    counter = counter+1
  Loop

%>

+ Recent posts