© 2026 schoolict.net (Ruwan Mangala Suraweera)
1.7 Iteration: FOR, WHILE and REPEAT–UNTIL Loopsපුනරාවර්තනය: FOR, WHILE සහ REPEAT–UNTIL ලූප
G.C.E. O/L Grade 11 ICT · Lesson 1G.C.E. O/L ICT · 11 ශ්රේණිය · පාඩම 1
In this videoමේ වීඩියෝවේ
- Iteration repeats steps.පුනරාවර්තනය පියවර නැවත කරයි.
- FOR: a fixed number of times.FOR: ස්ථාවර වාර ගණනක්.
- WHILE: checks first; may run 0 times.WHILE: මුලින් පරීක්ෂා කරයි; 0 වරක් විය හැක.
- REPEAT … UNTIL: checks last; runs at least once.REPEAT … UNTIL: අවසානයේ පරීක්ෂා; අවම වශයෙන් එක් වරක්.
- Update the variable to avoid infinite loops.අනන්ත ලූප වැළැක්වීමට විචල්යය යාවත්කාලීන කරන්න.
Notesසටහන්
Syllabus 10.7. A loop repeats statements. If we know how many times to repeat (e.g. 10 times), we use a FOR loop. If we don’t know (e.g. “until the user types −1”), we use a WHILE loop, which tests the condition at the beginning, or a REPEAT–UNTIL loop, which tests at the end. You will also learn to convert one loop into another.විෂය නිර්දේශය 10.7. ලූපයක් ප්රකාශ නැවත නැවත ක්රියාත්මක කරයි. කී වරක් කළ යුතුදැයි දන්නේ නම් (උදා 10 වරක්) FOR ලූපයක් භාවිත කරමු. නොදන්නේ නම් (උදා “පරිශීලකයා −1 ටයිප් කරන තුරු”) ආරම්භයේදී කොන්දේසිය පරීක්ෂා කරන WHILE ලූපයක් හෝ අවසානයේදී පරීක්ෂා කරන REPEAT–UNTIL ලූපයක් භාවිත කරමු. එක් ලූපයක් තවත් එකකට පරිවර්තනය කිරීමද ඉගෙන ගනිමු.
1. Known number of times: FOR1. දන්නා වාර ගණන: FOR
A FOR loop uses a counter that goes from a start value to an end value. The loop body runs once for each value. Example: the multiplication table of a number, 1 to 10.FOR ලූපයක් ආරම්භක අගයක සිට අවසාන අගයක් දක්වා යන ගණකයක් (counter) භාවිත කරයි. සෑම අගයකටම ලූපයේ ඇතුළත එක් වරක් ධාවනය වේ. උදාහරණය: සංඛ්යාවක ගුණන වගුව, 1 සිට 10 දක්වා.
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN INPUT N FOR i = 1 TO 10 DISPLAY N, " x ", i, " = ", N * i ENDFOR END
program TimesTable; var n, i: integer; begin write('Enter a number: '); readln(n); for i := 1 to 10 do writeln(n, ' x ', i, ' = ', n * i); end.
n = int(input("Enter a number: ")) for i in range(1, 11): print(n, "x", i, "=", n * i)
▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter a number: 7 7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 7 x 6 = 42 7 x 7 = 49 7 x 8 = 56 7 x 9 = 63 7 x 10 = 70
Trace of a FOR loop – factorial of 5 (F = 1 × 2 × 3 × 4 × 5):FOR ලූපයක අනුරේඛනය – 5 හි සාධකීය (F = 1 × 2 × 3 × 4 × 5):
program Factorial; var n, i, f: integer; begin write('Enter N: '); readln(n); f := 1; for i := 1 to n do f := f * i; writeln('Factorial = ', f); end.
n = int(input("Enter N: ")) f = 1 for i in range(1, n + 1): f = f * i print("Factorial =", f)
▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter N: 5 Factorial = 120
| ii | F = F * iF = F * i |
|---|---|
| 11 | 11 |
| 22 | 22 |
| 33 | 66 |
| 44 | 2424 |
| 55 | 120120 |
2. Unknown count, test at the beginning: WHILE2. නොදන්නා වාර ගණන, ආරම්භයේ පරීක්ෂාව: WHILE
A WHILE loop checks the condition first. If it is True, the body runs and the condition is checked again. If it is False at the start, the body runs zero times. Example: enter marks until −1 is typed. −1 is a sentinel (a stop signal), not a mark.WHILE ලූපයක් කොන්දේසිය මුලින්ම පරීක්ෂා කරයි. සත්ය නම් ඇතුළත ධාවනය වී කොන්දේසිය නැවත පරීක්ෂා කරයි. ආරම්භයේදීම අසත්ය නම් ඇතුළත ශුන්ය වරක් ධාවනය වේ. උදාහරණය: −1 ටයිප් කරන තුරු ලකුණු ඇතුළත් කිරීම. −1 යනු ලකුණක් නොව sentinel (නැවතීමේ සංඥාවක්) අගයකි.
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN Count = 0 Total = 0 INPUT Mark WHILE Mark <> -1 DO Count = Count + 1 Total = Total + Mark INPUT Mark ENDWHILE IF Count > 0 THEN DISPLAY Count, Total, Total / Count ELSE DISPLAY "No marks entered" ENDIF END
program MarksUntilStop; var mark, count, total: integer; begin count := 0; total := 0; write('Enter mark (-1 to stop): '); readln(mark); while mark <> -1 do begin count := count + 1; total := total + mark; write('Enter mark (-1 to stop): '); readln(mark); end; if count > 0 then begin writeln('Count = ', count); writeln('Total = ', total); writeln('Average = ', total / count:0:2); end else writeln('No marks entered'); end.
count = 0 total = 0 mark = int(input("Enter mark (-1 to stop): ")) while mark != -1: count = count + 1 total = total + mark mark = int(input("Enter mark (-1 to stop): ")) if count > 0: print("Count =", count) print("Total =", total) print(f"Average = {total / count:.2f}") else: print("No marks entered")
▶ Sample runනියැදි ධාවනය 1 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter mark (-1 to stop): 70 Enter mark (-1 to stop): 85 Enter mark (-1 to stop): 64 Enter mark (-1 to stop): -1 Count = 3 Total = 219 Average = 73.00
▶ Sample runනියැදි ධාවනය 2 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter mark (-1 to stop): -1 No marks entered
| MarkMark | CountCount | TotalTotal |
|---|---|---|
| 7070 | 11 | 7070 |
| 8585 | 22 | 155155 |
| 6464 | 33 | 219219 |
| -1-1 | 33 | 219219 |
Count = 3, Total = 219, so Average = 219 ÷ 3 = 73.00. If the first input is −1, the loop body never runs and the program says “No marks entered”.Count = 3, Total = 219, එබැවින් සාමාන්යය = 219 ÷ 3 = 73.00. පළමු ආදානය −1 නම් ලූපයේ ඇතුළත කිසි විටෙක ධාවනය නොවී “No marks entered” කියයි.
3. Unknown count, test at the end: REPEAT–UNTIL3. නොදන්නා වාර ගණන, අවසානයේ පරීක්ෂාව: REPEAT–UNTIL
A REPEAT–UNTIL loop runs the body first and checks the condition at the end, so the body always runs at least once. It stops when the condition becomes True. Perfect for checking input: keep asking until a valid mark (0–100) is typed.REPEAT–UNTIL ලූපයක් ඇතුළත මුලින් ධාවනය කර අවසානයේදී කොන්දේසිය පරීක්ෂා කරයි, එබැවින් ඇතුළත සැමවිටම අවම වශයෙන් එක් වරක් ධාවනය වේ. කොන්දේසිය සත්ය වූ විට නවතී. ආදාන පරීක්ෂාවට ඉතා හොඳයි: වලංගු ලකුණක් (0–100) ටයිප් කරන තුරු දිගටම ඉල්ලීම.
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN REPEAT INPUT Mark IF Mark < 0 OR Mark > 100 THEN DISPLAY "Invalid. Try again." ENDIF UNTIL Mark >= 0 AND Mark <= 100 DISPLAY Mark END
program ValidMark; var mark: integer; begin repeat write('Enter mark (0-100): '); readln(mark); if (mark < 0) or (mark > 100) then writeln('Invalid. Try again.'); until (mark >= 0) and (mark <= 100); writeln('Mark accepted: ', mark); end.
while True: mark = int(input("Enter mark (0-100): ")) if 0 <= mark <= 100: break print("Invalid. Try again.") print("Mark accepted:", mark)
▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter mark (0-100): 120 Invalid. Try again. Enter mark (0-100): -5 Invalid. Try again. Enter mark (0-100): 76 Mark accepted: 76
4. Comparing the three loops4. ලූප තුන සැසඳීම
| FORFOR | WHILEWHILE | REPEAT–UNTILREPEAT–UNTIL | |
|---|---|---|---|
| Number of timesවාර ගණන | Knownදනී | Unknownනොදනී | Unknownනොදනී |
| Condition testedකොන්දේසිය පරීක්ෂාව | Counter checked at the startගණකය ආරම්භයේ | At the beginningආරම්භයේ | At the endඅවසානයේ |
| Minimum runsඅවම ධාවන | 00 | 00 | 11 |
| Stops whenනවතින්නේ | Counter passes the end valueගණකය අවසාන අගය ඉක්මවූ විට | Condition is Falseකොන්දේසිය අසත්ය වූ විට | Condition is Trueකොන්දේසිය සත්ය වූ විට |
| PascalPascal | for i := 1 to 10 dofor i := 1 to 10 do | while … dowhile … do | repeat … until …;repeat … until …; |
| PythonPython | for i in range(1, 11):for i in range(1, 11): | while …:while …: | while True: … breakwhile True: … break |
5. Converting one loop into another5. එක් ලූපයක් තවත් එකකට පරිවර්තනය
The same task – display the even numbers 2, 4, 6, 8, 10 – written with each loop. To change a FOR into a WHILE: (1) set the counter before the loop, (2) write the condition, (3) increase the counter inside the loop. For REPEAT–UNTIL, reverse the condition (WHILE i <= 10 becomes UNTIL i > 10).එකම කාර්යය – 2, 4, 6, 8, 10 ඉරට්ටේ සංඛ්යා පෙන්වීම – එක් එක් ලූපයෙන් ලියා ඇත. FOR එකක් WHILE එකකට වෙනස් කිරීමට: (1) ලූපයට පෙර ගණකය සකසන්න, (2) කොන්දේසිය ලියන්න, (3) ලූපය තුළ ගණකය වැඩි කරන්න. REPEAT–UNTIL සඳහා කොන්දේසිය ප්රතිවිරුද්ධ කරන්න (WHILE i <= 10 වන්නේ UNTIL i > 10).
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN FOR i = 1 TO 5 DISPLAY i * 2 ENDFOR END
program EvenFor; var i: integer; begin for i := 1 to 5 do writeln(i * 2); end.
for i in range(2, 11, 2): print(i)
▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්රතිදානය
2 4 6 8 10
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN i = 2 WHILE i <= 10 DO DISPLAY i i = i + 2 ENDWHILE END
program EvenWhile; var i: integer; begin i := 2; while i <= 10 do begin writeln(i); i := i + 2; end; end.
i = 2 while i <= 10: print(i) i = i + 2
▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්රතිදානය
2 4 6 8 10
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN i = 2 REPEAT DISPLAY i i = i + 2 UNTIL i > 10 END
program EvenRepeat; var i: integer; begin i := 2; repeat writeln(i); i := i + 2; until i > 10; end.
i = 2 while True: # Python has no repeat-until print(i) i = i + 2 if i > 10: break
▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්රතිදානය
2 4 6 8 10
Key Wordsප්රධාන පද
Sample Q&Aආදර්ශ ප්රශ්න සහ පිළිතුරු
1When do we use a FOR loop?FOR ලූපයක් භාවිත කරන්නේ කවදාද?
2What is the main difference between WHILE and REPEAT–UNTIL?WHILE සහ REPEAT–UNTIL අතර ප්රධාන වෙනස කුමක්ද?
3What is a sentinel value?Sentinel අගයක් යනු කුමක්ද?
4What is the factorial of 5?5 හි සාධකීය කුමක්ද?
5How many times does for i := 1 to 10 run?for i := 1 to 10 කී වරක් ධාවනය වේද?
6What causes an infinite loop?අනන්ත ලූපයක් ඇති වන්නේ කුමක් නිසාද?
MCQබහුවරණ ප්රශ්න
Choose the correct answer for each question.සෑම ප්රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.
1A loop for a known number of times is…දන්නා වාර ගණනක් සඳහා ලූපය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Known count → FOR.දන්නා ගණන → FOR.
2Which loop always runs at least once?සැමවිටම අවම වශයෙන් එක් වරක් ධාවනය වන ලූපය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Test at the end.අවසානයේ පරීක්ෂාව.
3Which loop tests the condition at the beginning?ආරම්භයේදී කොන්දේසිය පරීක්ෂා කරන ලූපය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Pre-test.පූර්ව-පරීක්ෂණ.
4REPEAT … UNTIL condition stops when the condition is…REPEAT … UNTIL කොන්දේසිය නවතින්නේ කොන්දේසිය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Until it becomes true.සත්ය වන තුරු.
5In Python, range(1, 11) gives…Python හි range(1, 11) දෙන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
End not included.අවසානය ඇතුළත් නැත.
6The output of the factorial program for N = 5 is…N = 5 සඳහා සාධකීය වැඩසටහනේ ප්රතිදානය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
1×2×3×4×5.1×2×3×4×5.
7Marks 70, 85, 64 then −1 are entered. The average shown is…ලකුණු 70, 85, 64 පසුව −1 ඇතුළත් කරයි. පෙන්වන සාමාන්යය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
219 ÷ 3.219 ÷ 3.
8In the marks program, −1 is called a…ලකුණු වැඩසටහනේ −1 හඳුන්වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Stop signal.නැවතීමේ සංඥාව.
9If the first input is −1, the WHILE loop body runs…පළමු ආදානය −1 නම් WHILE ලූපයේ ඇතුළත ධාවනය වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Condition false at start.ආරම්භයේදීම අසත්යයි.
10Python has no REPEAT–UNTIL. We use…Python හි REPEAT–UNTIL නැත. අප භාවිත කරන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
while True with break.break සමඟ while True.
11Changing “WHILE i <= 10” to REPEAT–UNTIL gives…“WHILE i <= 10” REPEAT–UNTIL ට වෙනස් කළ විට…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Reverse the condition.කොන්දේසිය ප්රතිවිරුද්ධ කරන්න.
12Forgetting to increase the counter inside a WHILE loop causes…WHILE ලූපයක් තුළ ගණකය වැඩි කිරීම අමතක වීමෙන් ඇති වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Never stops.නොනවතී.
13How many lines does the multiplication-table program print after the input?ගුණන වගු වැඩසටහන ආදානයෙන් පසු පේළි කීයක් මුද්රණය කරයි?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
i = 1 to 10.i = 1 සිට 10.
14Asking again and again until a valid mark is typed is best done with…වලංගු ලකුණක් ටයිප් කරන තුරු නැවත නැවත ඉල්ලීමට වඩාත් සුදුසු…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Must ask at least once.අවම වශයෙන් එක් වරක් ඉල්ලිය යුතුය.
15for i := 1 to 5 do write(i * 2) prints…for i := 1 to 5 do write(i * 2) මුද්රණය කරන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Doubles of 1–5.1–5 දෙගුණ.
MCQ answer keyMCQ පිළිතුරු
- A – Known count → FOR.දන්නා ගණන → FOR.
- D – Test at the end.අවසානයේ පරීක්ෂාව.
- B – Pre-test.පූර්ව-පරීක්ෂණ.
- C – Until it becomes true.සත්ය වන තුරු.
- A – End not included.අවසානය ඇතුළත් නැත.
- B – 1×2×3×4×5.1×2×3×4×5.
- C – 219 ÷ 3.219 ÷ 3.
- D – Stop signal.නැවතීමේ සංඥාව.
- A – Condition false at start.ආරම්භයේදීම අසත්යයි.
- A – while True with break.break සමඟ while True.
- C – Reverse the condition.කොන්දේසිය ප්රතිවිරුද්ධ කරන්න.
- C – Never stops.නොනවතී.
- B – i = 1 to 10.i = 1 සිට 10.
- D – Must ask at least once.අවම වශයෙන් එක් වරක් ඉල්ලිය යුතුය.
- B – Doubles of 1–5.1–5 දෙගුණ.
Structured Questionsව්යුහගත ප්රශ්න
1(i) Give one difference between a pre-test and a post-test loop. (2 marks)
(ii) Give one example of each in Pascal. (2 marks)(i) පූර්ව-පරීක්ෂණ සහ පශ්චාත්-පරීක්ෂණ ලූප අතර එක් වෙනසක් දෙන්න. (ලකුණු 2)
(ii) Pascal හි එක් එකකට උදාහරණයක් දෙන්න. (ලකුණු 2) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
2Write a program (Pascal or Python) to input a number and display its multiplication table from 1 to 10. (4 marks)සංඛ්යාවක් ආදානය කර එහි ගුණන වගුව 1 සිට 10 දක්වා පෙන්වන වැඩසටහනක් (Pascal හෝ Python) ලියන්න. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
program TimesTable; var n, i: integer; begin write('Enter a number: '); readln(n); for i := 1 to 10 do writeln(n, ' x ', i, ' = ', n * i); end.
n = int(input("Enter a number: ")) for i in range(1, 11): print(n, "x", i, "=", n * i)
▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter a number: 7 7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 7 x 6 = 42 7 x 7 = 49 7 x 8 = 56 7 x 9 = 63 7 x 10 = 70
3Write pseudocode that keeps reading marks until −1 is entered, then displays the count, total and average. (5 marks)−1 ඇතුළත් කරන තුරු ලකුණු කියවා, පසුව ගණන, එකතුව සහ සාමාන්යය පෙන්වන ව්යාජ කේතය ලියන්න. (ලකුණු 5) (5 marksලකුණු 5)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN Count = 0 Total = 0 INPUT Mark WHILE Mark <> -1 DO Count = Count + 1 Total = Total + Mark INPUT Mark ENDWHILE IF Count > 0 THEN DISPLAY Count, Total, Total / Count ELSE DISPLAY "No marks entered" ENDIF END
| MarkMark | CountCount | TotalTotal |
|---|---|---|
| 7070 | 11 | 7070 |
| 8585 | 22 | 155155 |
| 6464 | 33 | 219219 |
| -1-1 | 33 | 219219 |
4Rewrite this FOR loop as a WHILE loop: FOR i = 1 TO 5 : DISPLAY i * 2 : ENDFOR. (3 marks)මෙම FOR ලූපය WHILE ලූපයක් ලෙස නැවත ලියන්න: FOR i = 1 TO 5 : DISPLAY i * 2 : ENDFOR. (ලකුණු 3) (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN i = 2 WHILE i <= 10 DO DISPLAY i i = i + 2 ENDWHILE END
5Complete a trace table for the factorial program with N = 5 and give the output. (3 marks)N = 5 සමඟ සාධකීය වැඩසටහන සඳහා අනුරේඛන වගුවක් සම්පූර්ණ කර ප්රතිදානය දෙන්න. (ලකුණු 3) (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
| ii | F = F * iF = F * i |
|---|---|
| 11 | 11 |
| 22 | 22 |
| 33 | 66 |
| 44 | 2424 |
| 55 | 120120 |
🎮 Game🎮 ක්රීඩා
Summary & Downloadsසාරාංශය සහ බාගත කිරීම්
Key pointsප්රධාන කරුණු
- FOR: known number of times.FOR: දන්නා වාර ගණන.
- WHILE: test at the beginning; may run 0 times.WHILE: ආරම්භයේ පරීක්ෂාව; 0 වරක් ධාවනය විය හැක.
- REPEAT–UNTIL: test at the end; runs at least once.REPEAT–UNTIL: අවසානයේ පරීක්ෂාව; අවම වශයෙන් එක් වරක්.
- REPEAT stops when the condition is True.REPEAT නවතින්නේ කොන්දේසිය සත්ය වූ විටය.
- A sentinel (−1) tells the loop to stop.Sentinel (−1) ලූපයට නවතින ලෙස කියයි.
- Python: for … in range(); while; while True + break.Python: for … in range(); while; while True + break.
- Convert: set counter, test, increase inside.පරිවර්තනය: ගණකය සකසන්න, පරීක්ෂා කරන්න, තුළ වැඩි කරන්න.
- Always move the loop towards its end – avoid infinite loops.ලූපය අවසානය දෙසට ගෙන යන්න – අනන්ත ලූප වළකින්න.
