8.1.7 Iteration (REPEAT … UNTIL) Flashcards
1
Q
What is a REPEAT … UNTIL loop?
A
- It is a post condition-controlled loop.
- The condition is checked at the end of the loop.
- The code inside the loop will always execute at least once.
Used when you do not know how many time to iterate.
2
Q
REPEAT … UNTIL loop Example
A
STRING: password = “”
REPEAT
OUTPUT “Enter password: “
INPUT password
UNTIL password = “1L0v3Marm1t3”
OUTPUT “Access Granted!”
3
Q
IMPORTANT
A
C# Does not have a REPEAT … UNTIL loop, but does have a DO … WHILE loop (where the condition is checked at the end of the loop).