Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assignment 2 - question on string

 
John Peters
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed in the solution that the string variable indicating whether the number is "even" or "odd" is declared and initialized to "odd". Then if the number is even, the string is changed to "even". Is there a performance or optimization reason for arranging the code like this?
 
Brian Holsenbeck
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked the same question after the java3 assignment. The reply was that it was shorter, but still very readable.
 
John Peters
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes sense.
Thanks, Brian.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic