+ 15
what about for loop ...t can't understand how its work ..anyone help me ....
hope it's helpful me and much people
10 Answers
+ 5
For loop keeps execution of certain function provided the condition in it remains true
Else
it does not keep (it stops) executing the function in it
they're always long and sometimes they iterate themselves so they're called loops
Check the extensive use of for loops here
https://code.sololearn.com/c3hvJyz02z0r/?ref=app
+ 3
from Tamil nadu?
+ 3
Sreejith oh ok. There's an another person near my house named Sreejith so I thought it was you!
+ 3
Sreejith ok
+ 2
x=(1,3,341,1,2)
for var in x:
print (var)
#output
1
3
341
1
2
var counts how many elements or characters are there in x
+ 2
Sreejith are you from India?
+ 1
yes
+ 1
ok well I'm not that person
+ 1
for loop is like a loop. it will keep on going again and again unless it fits the statement you gave in the beginning after the for statement. I had and still sometimes have problem with it too, best way is to try to solve some easy problems. and practice.
0
The loop is used if we want to repeat a process for many times like if u want to print a multiplication table it takes much time if u use printf but if u use for loop it is very easy and it takes less space