회원 로그인
|
MEL - 반복 제어문 for
* 반복 제어문
while, do-while, for-in, for
for
주어진 조건을 만족시키는 동안 반복해서 실행한다. while와 do-while와 다른 점은 변수 초기값을 설정할 수 있다는 점이다.
tag)
$temp equals =0
$temp equals =1
$temp equals =2
$temp equals =3
$temp equals =4
int $temp;
$temp를 정수형으로 한다.
for ($temp = 0; $temp < 5; $temp = $temp + 1)
$temp 초기값을 0으로 하고, 조건식에 맞을 때까지 $temp에 1씩 더해진다.
print ("$temp equals =" + $temp + "n");
() 안에 내용을 출력하게 된다. " "(string)을 그대로 출력하게 되고, +로 이어서 변수와 명령어를 출력하게 된다.
n은 한줄 띄기를 하게된다.
while, do-while, for-in, for
for
주어진 조건을 만족시키는 동안 반복해서 실행한다. while와 do-while와 다른 점은 변수 초기값을 설정할 수 있다는 점이다.
tag)
//initialization 변수 설정, 조건식이 참이되면 statement를 실행하고 거짓이면 종료한다. change of condition 조건식을 계산한다. for (initialization; condition; change of condition) { statement 1; statement 2; ...... }예제1)
int $temp; for ($temp = 0; $temp < 5; $temp = $temp + 1) { print ("$temp equals =" + $temp + "n"); }실행하면
$temp equals =0
$temp equals =1
$temp equals =2
$temp equals =3
$temp equals =4
int $temp;
$temp를 정수형으로 한다.
for ($temp = 0; $temp < 5; $temp = $temp + 1)
$temp 초기값을 0으로 하고, 조건식에 맞을 때까지 $temp에 1씩 더해진다.
print ("$temp equals =" + $temp + "n");
() 안에 내용을 출력하게 된다. " "(string)을 그대로 출력하게 되고, +로 이어서 변수와 명령어를 출력하게 된다.
n은 한줄 띄기를 하게된다.
댓글 0개
| 엮인글 0개
466개(19/24페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
마야 뷰포트 네비게이션 팁 | 푸딩뱃살 | 42822 | 2020.04.06 17:22 | |
Maya 버전 별 Python 버전 | 푸딩뱃살 | 64133 | 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 | 5817 | 2008.02.19 13:45 |
102 | [참고] Simulating Musculature in Maya | artsOne | 3011 | 2008.02.17 18:41 |
101 | [Script] MEL - checkBox | artsone | 3307 | 2008.02.11 02:49 |
100 | [Script] 연산자(Operator) 정의 | artsone | 2474 | 2008.02.09 18:17 |
99 | [Script] 변수(Varialbe) 정의 | artsone | 2387 | 2008.02.02 19:00 |
98 | [Script] [스크랩] Expressions to scale, rotate and spin by Aziz Khan | artsone | 2737 | 2008.01.31 03:36 |
97 | [Base] 속성(Attribute) 정의 | artsone | 2031 | 2008.01.29 22:39 |
96 | [Script] MEL - 이동 제어문 return | artsone | 3194 | 2008.01.28 21:48 |
95 | [Script] MEL - 이동 제어문 continue | artsone | 3113 | 2008.01.28 21:17 |
94 | [Script] MEL - 이동 제어문 break | artsone | 3327 | 2008.01.28 21:01 |
>> | [Script] MEL - 반복 제어문 for | artsone | 3447 | 2008.01.25 21:12 |
92 | [Script] MEL - 반복 제어문 for-in | artsone | 3298 | 2008.01.28 22:39 |
91 | [Script] MEL - 반복 제어문 do-while | artsone | 2843 | 2008.01.25 20:58 |
90 | [Script] MEL - 반복 제어문 while | artsone | 3127 | 2008.01.23 23:46 |
89 | [Script] MEL - 조건 제어문 ?: | artsone | 3077 | 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 |