Index
 
  Reference for Wiring 1.0 (ALPHA) 0017+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.
Name  

for()

   
Examples  
int i; 
for(i=0; i<10; i=i+1) { 
  digitalWrite(i, HIGH); 
} 

Description   Controls a sequence of repetitions. A for() structure has three parts: init, test, and update. Each part must be separated by a semi-colon ";". The loop continues until the test evaluates to false. When a for() structure is executed, the following sequence of events occurs:
1. The init statement is executed
2. The test is evaluated to be true or false
3. If the test is true, jump to step 4. If the test is False, jump to step 6
4. Execute the statements within the block
5. Execute the update statement and jump to step 2
6. Exit the loop.

반복적인 실행을 제어 합니다. for() 문은 init, test 그리고 update 의 3 부분으로 구성됩니다. 각 부분은 세미컬론 ";"으로 구분됩니다. 루프는 테스트 결과가 FALSE 이면 계속됩니다. for() 구조가 실행되면 다음 연속적인 동작이 일어납니다.

1. init 초기화 문이 실행된다.
2. 검사 조건이 실행되며 참, 거짖을 판단한다.
3. 검사 결과가 참이면 스텝 4 로 간다. 검사 결과가 거짖이면 스텝 6 으로 간다.
4. 블록내의 무을 실행한다.
5. 업데이트 문을 실행하고 스텝 2 로 점프한다.
6 루프문을 종료한다.

 

   
Syntax  
for(init; test; update) { 
  statements
} 
   
Parameters  
init   statement executed once when beginning loop
루프 실행시 처음 한번만 실행한다.
test   if the test evaluates to true, the statements execute
검사 결과가 true 이면 문이 실행됩니다.
update   executes at the end of each iteration
마지막 항목이 실행된후 업데이트 됩니다.
statements   collection of statements executed each time through the loop
매번 루프를 통한 실행문의 집합입니다. 
   
Usage   Web & Application
   
Related   while()