회원 로그인
|
MEL - 반복 제어문 while
* 반복 제어문
while, do-while, for-in, for
while
주어진 조건을 만족시키는 동안 반복해서 실행한다.
tag)
$temp equals =0
$temp equals =1
$temp equals =2
$temp equals =3
$temp equals =4
int $temp = 0;
정수형 $temp 변수에 0값을 지정한다.
while ($temp < 5)
$temp가 5보다 작을 경우 실행되는 조건이다. 5보다 크게되면 while문이 중단된다.
print ("$temp equals =" + $temp + "n");
() 안에 내용을 출력하게 된다. " "(string)을 그대로 출력하게 되고, +로 이어서 변수와 명령어를 출력하게 된다.
n은 한줄 띄기를 하게된다.
$temp = $temp + 1;
$temp 처음 값은 0이고, 여기에 1을 더해서 다시 $temp에 저장되어 진다.
위 while문을 for문으로 바꾸면 아래와 같다.
while, do-while, for-in, for
while
주어진 조건을 만족시키는 동안 반복해서 실행한다.
tag)
//condition이 참이면 statement 1, 2를 실행하고, 거짓이면 while문을 벗어난다. while (condition) { statement 1; statement 2; ...... } 예제1)
int $temp = 0; while ($temp < 5) { print ("$temp equals =" + $temp + "n"); $temp = $temp + 1; }실행하면
$temp equals =0
$temp equals =1
$temp equals =2
$temp equals =3
$temp equals =4
int $temp = 0;
정수형 $temp 변수에 0값을 지정한다.
while ($temp < 5)
$temp가 5보다 작을 경우 실행되는 조건이다. 5보다 크게되면 while문이 중단된다.
print ("$temp equals =" + $temp + "n");
() 안에 내용을 출력하게 된다. " "(string)을 그대로 출력하게 되고, +로 이어서 변수와 명령어를 출력하게 된다.
n은 한줄 띄기를 하게된다.
$temp = $temp + 1;
$temp 처음 값은 0이고, 여기에 1을 더해서 다시 $temp에 저장되어 진다.
위 while문을 for문으로 바꾸면 아래와 같다.
for ($temp = 0; $temp < 5; $temp = $temp + 1) { print ("$temp equals =" + $temp + "n"); }
댓글 0개
| 엮인글 0개
466개(19/24페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
마야 뷰포트 네비게이션 팁 | 푸딩뱃살 | 42792 | 2020.04.06 17:22 | |
Maya 버전 별 Python 버전 | 푸딩뱃살 | 64102 | 2014.01.08 17:59 | |
104 | [Script] Python for Maya - 2. select (선택) | artsOne | 5020 | 2008.02.20 23:18 |
103 | [Script] Python for Maya - 1. 시작 | artsOne | 5816 | 2008.02.19 13:45 |
102 | [참고] Simulating Musculature in Maya | artsOne | 3011 | 2008.02.17 18:41 |
101 | [Script] MEL - checkBox | artsone | 3306 | 2008.02.11 02:49 |
100 | [Script] 연산자(Operator) 정의 | artsone | 2473 | 2008.02.09 18:17 |
99 | [Script] 변수(Varialbe) 정의 | artsone | 2385 | 2008.02.02 19:00 |
98 | [Script] [스크랩] Expressions to scale, rotate and spin by Aziz Khan | artsone | 2736 | 2008.01.31 03:36 |
97 | [Base] 속성(Attribute) 정의 | artsone | 2029 | 2008.01.29 22:39 |
96 | [Script] MEL - 이동 제어문 return | artsone | 3192 | 2008.01.28 21:48 |
95 | [Script] MEL - 이동 제어문 continue | artsone | 3111 | 2008.01.28 21:17 |
94 | [Script] MEL - 이동 제어문 break | artsone | 3326 | 2008.01.28 21:01 |
93 | [Script] MEL - 반복 제어문 for | artsone | 3446 | 2008.01.25 21:12 |
92 | [Script] MEL - 반복 제어문 for-in | artsone | 3297 | 2008.01.28 22:39 |
91 | [Script] MEL - 반복 제어문 do-while | artsone | 2842 | 2008.01.25 20:58 |
>> | [Script] MEL - 반복 제어문 while | artsone | 3127 | 2008.01.23 23:46 |
89 | [Script] MEL - 조건 제어문 ?: | artsone | 3076 | 2008.01.23 23:12 |
88 | [Script] MEL - 조건 제어문 switch | artsone | 3140 | 2008.01.23 22:50 |
87 | [Script] MEL - 조건 제어문 if | artsone | 3905 | 2008.01.21 01:23 |
86 | [Script] Expression - rand | artsone | 2406 | 2008.01.20 23:43 |
85 | [Rendering] [스크랩] Maya software render에서 그림자에도 motion blur적용하는 방법 | artsone | 4700 | 2008.01.15 17:35 |