This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I use 1 boolean statement for 2 variables ?  RSS feed

 
WeiJie Lim
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to code a boolean statement to check if the year stored in the following variables is a leap year or not. I remembered being able to use only 1 boolean statement for this, but I forgotten how I did it =/

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want to repeat the whole statement each time, you can ofcourse write a method that contains the statement, and call the method instead of repeating the whole statement.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!