반복문
ASP
' For
For 변수 = 시작값 To 종료값
구문
Next
' For
For 변수 = 시작값 To 종료값 Step 증감값
구문
Next
' For Each
For Each 변수 In 객체
구문
Next
' Do While
Do While 조건식
구문
Loop
' Do
Do
구문
Loop While 조건식
' Do Until (역조건문)
Do Until 조건식
구문
Loop
' Do (역조건문)
Do
구문
Loop Until 조건식
' Exit
Exit For
Exit Do
JSP/Java
// for
for (초기화식; 조건식; 증감식) {
구문;
}
// for
for (변수 : 객체) {
구문;
}
// while
while (조건식) {
구문;
}
// do ~ while
do {
구문;
} while (조건식);
// label, continue, break
loop1:
for (초기화식; 조건식; 증감식) {
if (조건식) {
continue loop1;
}
loop2:
for (초기화식; 조건식; 증감식) {
if (조건식) {
break loop2;
}
}
}
JSTL
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!-- forEach -->
<c:forEach var="변수" begin="시작값" end="종료값">
${변수}
</c:forEach>
<c:forEach var="변수" begin="시작값" end="종료값" step="증감값">
${변수}
</c:forEach>
<c:forEach var="변수" items="${객체}">
${변수}
</c:forEach>
<!-- forTokens -->
<c:forTokens var="변수" items="영화,만화,도서" delims=",">
${변수}
</c:forTokens>
<!-- varStatus -->
<c:forEach var="변수" items="${객체}" varStatus="status">
${status.current} <!-- 현재 아이템 -->
${status.index} <!-- 현재 인덱스 (0부터 시작) -->
${status.count} <!-- 현재 카운트 (1부터 시작) -->
${status.first} <!-- 처음인지 여부 (true/false) -->
${status.last} <!-- 마지막인지 여부 (true/false) -->
${status.begin} <!-- 시작값 -->
${status.end} <!-- 종료값 -->
${status.step} <!-- 증감값 -->
</c:forEach>
JavaScript
// for
for (초기화식; 조건식; 증감식) {
구문;
}
// for ~ in
for (변수 in 객체) {
구문;
}
// for ~ of
for (변수 of 객체) {
구문;
}
// while
while (조건식) {
구문;
}
// do ~ while
do {
구문;
} while (조건식);
// label, continue, break
loop1:
for (초기화식; 조건식; 증감식) {
if (조건식) {
continue loop1;
}
loop2:
for (초기화식; 조건식; 증감식) {
if (조건식) {
break loop2;
}
}
}
Shell Script
# for
for ((초기화식; 조건식; 증감식))
do
구문
done
# for
for 변수 in {시작값..종료값}
do
구문
done
# for
for 변수 in {시작값..종료값..증감값}
do
구문
done
# for
for 변수 in 범위
do
구문
done
# while
while [ 조건식 ]
do
구문
done
# until (역조건문)
until [ 조건식 ]
do
구문
done
# continue, break
continue
break
MyBatis
<foreach collection="객체" item="item" index="index"
open="반복문 시작 문자" close="반복문 종료 문자" separator="반복문 분리 기호" nullable="false">
#{item}
#{index}
</foreach>