
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This resource provides a comprehensive overview of iteration in programming, focusing on while, repeat, and for loops. It explains syntax, usage, range checks, and how to avoid infinite loops. Random number generation and nested for loops are also covered, with practical examples and pseudocode. Designed for high school students, it aims to enhance problem-solving skills and code efficiency by building a solid foundation in iterative programming. Worksheets and tasks encourage active learning, making it ideal for classroom instruction and self-study.
Typology: Slides
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















Unit 1 Fundamentals of programming
Objectives
Unit 1 Fundamentals of programming WHILE … ENDWHILE loop
WHILE Condition x = True Execute statement a Execute statement b etc.... END WHILE
Unit 1 Fundamentals of programming Iteration entry condition
x 0 WHILE x < 2 x x+ OUTPUT x ENDWHILE OUTPUT “The end” x Output 0
Unit 1 Fundamentals of programming Worksheet 3
Unit 1 Fundamentals of programming REPEAT .. UNTIL loop
x 0 Repeat x x+ OUTPUT x UNTIL x >= 2 OUTPUT “The end” x Output 0
Unit 1 Fundamentals of programming Performing a range check
OUTPUT “Enter age” age USERINPUT UNTIL age > 11 AND age <= 18 OUTPUT “Age is”, age
Unit 1 Fundamentals of programming An equivalent WHILE loop
age = 0 WHILE age < 12 OR age > 18 OUTPUT “Enter age” age USERINPUT ENDWHILE OUTPUT “Age is”, age
Unit 1 Fundamentals of programming Infinite loop
Unit 1 Fundamentals of programming Infinite loops in control and data sensing applications
Unit 1 Fundamentals of programming FOR .. NEXT loop
Unit 1 Fundamentals of programming FOR .. NEXT loop
Unit 1 Fundamentals of programming Stepping backwards
Unit 1 Fundamentals of programming Using a WHILE .. ENDWHILE loop as an alternative
index 1 WHILE index < 4 OUTPUT index index index + 1 ENDWHILE FOR index 1 to? OUTPUT index NEXT index