Lesson 10 of 34
for Loop
8 min 25 XP
for loop के तीन हिस्से होते हैं: शुरुआत (int i = 1), condition (i <= 5) और step (i++)। जब तक condition true है, loop चलता रहता है।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.Loop से पहले एक variable बनाएँ और loop के अंदर उसमें जोड़ते जाएँ। Totals ऐसे ही निकाले जाते हैं।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.Loop में declare किया गया variable, जैसे i, loop के बाहर मौजूद नहीं रहता।