The ____ control structure is used when a ____ of code needs to be executed a certain number of times. ____ provides two types of repetition structures; the ‘while’ and ‘for ____. Both loops perform the same function: to check whether a certain ____ is true or not. If the condition is true, the program will execute the instruction(s) inside the loop repeatedly; until the condition is no longer ____. When that happens, the program will skip the loop and will start executing the code that comes after it While-loopThe while-____ checks the control variable condition continuously. If the condition is ____, then the code between the curly braces ({...}) is executed sequentially. Once the ____ is done executing the instructions inside the while-loop, it returns to the top of the loop and checks the condition again. If the condition is still true, the ____ executes again. The process will repeat until the while-loop expression/condition becomes ____. When that happens, the program will skip the while-loop and will execute the code that comes after it initialise the control ________() { set pin#12 as output //red LED set pin#7 as output //blue LED while (control variable) { turn red LED ON wait 0.5s (500ms) turn red LED OFF wait 0.5s (____) i=i+1 } turn red LED OFF turn blue LED ON } ____() { } For-loopThe for-loop performs exactly like the while-loop, in the sense that it ____ whether a certain condition is true or not. If the condition is true, then the program will run the loop’s block of code ____. When the condition is no longer true, the program will ____ the instructions inside the loop and will start executing the code that comes after it. However, the code ____ for the for-loop is different than that of the while-loop. The for-loop has three arguments; the initialisation of the loop’s control ____, the loop-continuation condition, and the control variable expression. ____() {set pin____12 as output // LED } ____() { for (initialise the control ____ i; i<3; increment i ) { turn LED ON wait 200ms turn LED OFF wait 200ms i=i+1 } turn LED OFF ____ 5s ____
0%
Repetition control structure
แชร์
แชร์
แชร์
โดย
Decred18
แก้ไขเนื้อหา
สั่งพิมพ์
ฝัง
เพิ่มเติม
กำหนด
ลีดเดอร์บอร์ด
แสดงเพิ่มขึ้น
แสดงน้อยลง
ลีดเดอร์บอร์ดนี้ตอนนี้เป็นส่วนตัว คลิก
แชร์
เพื่อทำให้เป็นสาธารณะ
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานโดยเจ้าของทรัพยากร
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานเนื่องจากตัวเลือกของคุณแตกต่างสำหรับเจ้าของทรัพยากร
แปลงกลับตัวเลือก
เติมประโยคให้สมบูรณ์
เป็นแม่แบบแบบเปิดที่ไม่ได้สร้างคะแนนสำหรับลีดเดอร์บอร์ด
ต้องลงชื่อเข้าใช้
สไตล์ภาพ
แบบ อักษร
ต้องสมัครสมาชิก
ตัวเลือก
สลับแม่แบบ
แสดงทั้งหมด
รูปแบบเพิ่มเติมจะปรากฏเมื่อคุณเล่นกิจกรรม
เปิดผลลัพธ์
คัดลอกลิงค์
คิวอาร์โค้ด
ลบ
คืนค่าการบันทึกอัตโนมัติ:
ใช่ไหม