내용으로 건너뛰기
잡개발자 리토의 잡위키
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
미디어 관리자
사이트맵
로그인
>
미디어 관리자
사이트맵
기술문서:레퍼런스:언어:반복문
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
{{htmlmetatags> metatag-description=(반복문, 반복, 루프문, 루프, 프로그래밍 언어, Programming Language, ASP, JSP, Java, JSTL, JavaScript, Shell Script, MyBatis) metatag-og:description=(반복문, 반복, 루프문, 루프, 프로그래밍 언어, Programming Language, ASP, JSP, Java, JSTL, JavaScript, Shell Script, MyBatis) }} ====== 반복문 ====== ===== ASP ===== * 대/소문자 구분 없음 * 파스칼 표기법 지향 <sxh vb; gutter: true;> ' 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 </sxh> ===== JSP/Java ===== <sxh java; gutter: true;> // for for (초기화식; 조건식; 증감식) { 구문; } // for for (변수 : 객체) { 구문; } // while while (조건식) { 구문; } // do ~ while do { 구문; } while (조건식); // label, continue, break loop1: for (초기화식; 조건식; 증감식) { if (조건식) { continue loop1; } loop2: for (초기화식; 조건식; 증감식) { if (조건식) { break loop2; } } } </sxh> ===== JSTL ===== <sxh java; gutter: true;> <%@ 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> </sxh> ===== JavaScript ===== <sxh javascript; gutter: true;> // 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; } } } </sxh> ===== Shell Script ===== <sxh bash; gutter: true;> # 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 </sxh> ===== MyBatis ===== <sxh xml; gutter: true;> <foreach collection="객체" item="item" index="index" open="반복문 시작 문자" close="반복문 종료 문자" separator="반복문 분리 기호" nullable="false"> #{item} #{index} </foreach> </sxh>
문서 도구
문서 보기
이전 판
맨 위로