• 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
Sheriff
Posts: 48652
56
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic