Please help me in this concept | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please help me in this concept

19th Aug 2018, 11:06 AM
Tirumala Vinay
Tirumala Vinay - avatar
5 Answers
+ 2
whats specifically would you like to know?
19th Aug 2018, 11:09 AM
Robert Atkins
Robert Atkins - avatar
+ 2
the counter variable is what you use to check how many times a loop as ran, so say your teacher punishes you and makes you right "im sorry" on the board 10 times here is what is happening in code int timesWritten = 0; while(timesWritten<10){ write("im sorry"); timesWritten++; } so every time you write im sorry, your counter increases by one, the counter is timesWritten and without updating this variable the loop would run endlessly.
19th Aug 2018, 11:19 AM
Robert Atkins
Robert Atkins - avatar
+ 1
What is counter variable and how it is used so far
19th Aug 2018, 11:10 AM
Tirumala Vinay
Tirumala Vinay - avatar
+ 1
tq Mr Atkins for your help
19th Aug 2018, 11:20 AM
Tirumala Vinay
Tirumala Vinay - avatar
0
Tirumala Vinay anytime, glad i could help!
19th Aug 2018, 11:24 AM
Robert Atkins
Robert Atkins - avatar