• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help in data displaying

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Below is my code which printing month and year and the out put is displaying like this :

Month 1 Year 2009
Month 2 Year 2009
Month 3 Year 2009
Month 4 Year 2009
Month 5 Year 2009
Month 6 Year 2009
Month 7 Year 2009
Month 8 Year 2009
Month 9 Year 2009
Month 10 Year 2009
Month 11 Year 2009
Month 12 Year 2009
Month 1 Year 2010
Month 2 Year 2010
Month 3 Year 2010
Month 4 Year 2010
Month 5 Year 2010
Month 6 Year 2010
Month 7 Year 2010
Month 8 Year 2010
Month 9 Year 2010
Month 10 Year 2010
Month 11 Year 2010
Month 12 Year 2010


and want to run this loop only till month is 6 and year is 2010. like this
Month 1 Year 2009
Month 2 Year 2009
Month 3 Year 2009
Month 4 Year 2009
Month 5 Year 2009
Month 6 Year 2009
Month 7 Year 2009
Month 8 Year 2009
Month 9 Year 2009
Month 10 Year 2009
Month 11 Year 2009
Month 12 Year 2009
Month 1 Year 2010
Month 2 Year 2010
Month 3 Year 2010
Month 4 Year 2010
Month 5 Year 2010
Month 6 Year 2010








Please help me.

Thanks
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15480
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add an if statement inside the for loop with a break; to exit the loop when i == 5 and minYear == 2010.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check whether, this code suits you or not..
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic