Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Do these parenthesis change anything?  RSS feed

 
David Crossett
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are these code snippets the same? If I'm testing for ALL of them to be true, is there a better way or does it not really matter, since eventually they are all testing, even if in a group?

and:

Thanks!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, these parentheses don't change the meaning. The same code should be emitted. But they do, at least in my opinion, make the code a bit easier to read and understand, so they don't hurt!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!