[코딩] While 문


[코딩] While 문

약간의 변형만 있고 반복되는 코드가 있을때는 Loop이 되는지를 확인한다음에 While 문을 사용하면 손쉽게 해결할 수 있다. Loop을 사용할때는 아래 질문을 해보면서 필요한 부분을 수정하면 된다. /* The Three Loop Questions:1. What do I want to repeat? -> The text function with the message!2. What do I want to change each time? -> The y position, increasing by 20 each time.3. How long should we repeat?-> As long as y is less than 400, all the way down.*/ 아래 코드에서 1. 반복하고 싶은건 문장. 2. 변경하고 싶은것은 Y의 위치. (20씩 계속 추가)3. 언제까지 반복하고 싶은지는 Y의 포지션이 400 이하일..........



원문링크 : [코딩] While 문