• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt:control flow working

 
mansi gupte
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


can some please explain the working of this code?


thanks,
Piya
 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the output what iam geting is
Green

and my explanation is dat


while your i becomes 3 continue from start...but at that time i will remain 3 won't reinitialize and it becomes
4 because of i++
then count becomes 3 and break start means control will leave out of the iterator..i mean control will go to the code just after that for loop..

now it will print the colours[3] and its green




 
Campbell Ritchie
Marshal
Posts: 53135
124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you are not trying to tell us that labelled continue is good programming practice.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!