Lesson 10 of 34
for loop: மீண்டும் மீண்டும் செய்தல்The for Loop
8 min 25 XP
for loop-ல் மூன்று பகுதிகள்: தொடக்கம் (int i = 1), condition (i <= 5), மாற்றம் (i++). Condition true ஆக இருக்கும் வரை loop இயங்கும்.
A for loop has three parts: a start (int i = 1), a condition (i <= 5) and a step (i++). The loop keeps running while the condition is true.
Example: edit me and press Run
Press Run to see the result here.Loop-க்கு வெளியே ஒரு variable-ஐ உருவாக்கி, loop உள்ளே மதிப்புகளைச் சேர்க்கலாம். இதுவே கூட்டுத்தொகை (sum) கணக்கிடும் வழி.
Create a variable before the loop and add to it inside the loop. This is how we calculate totals.
Example: edit me and press Run
Press Run to see the result here.Loop உள்ளே உருவாக்கப்பட்ட i, loop-க்கு வெளியே கிடைக்காது.
A variable declared in the loop, like i, does not exist outside the loop.