• Post Reply Bookmark Topic Watch Topic
  • New Topic

In my code. Why does my Switch statement resort to using the default?  RSS feed

 
Lisa Austin
Ranch Hand
Posts: 178
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just for my learning. I am using Random but I have it set to 12. While running my code it has come up with "Invalid month" a few times. Does the value 12 mean 0 - 11 and not 1 - 12?

 
Lisa Austin
Ranch Hand
Posts: 178
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I had a blank moment. I think it does use 0 - 11 and not 1-12 .
 
Knute Snortum
Sheriff
Posts: 4087
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lisa Austin wrote:Sorry I had a blank moment. I think it does use 0 - 11 and not 1-12 .

That's correct. And we all have those moments!
 
Lisa Austin
Ranch Hand
Posts: 178
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:
Lisa Austin wrote:Sorry I had a blank moment. I think it does use 0 - 11 and not 1-12 .

That's correct. And we all have those moments!


Thanks!!
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It says so in the API documentation, although some of the newer documentation, e.g. this and this makes it so much easier to remember.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!