Is there an analogous form of the following code:
if(month == 4,6,9,11)
{
do something;
}
Or must it be:
if(month == 4 ||
C# as I don't know Java:
int[] DaysInMonth = new int[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
if (DaysInMonth[month] == 31) ...
Forget the fancy logic that many people are advocating--this way is much clearer and easier to debug.
However, to answer the question you actually asked in your message:
if (false) ...
as there are no months with MORE than 31 days!
Edit: Yes, I didn't address the leap year. That has to be handled separately. The question was whether the month had 31 days, though--something mine DOES answer. I could have done it with an array of bools but since the array needs to be there anyway why not put the lengths in?