Is there an analogous form of the following code:
if(month == 4,6,9,11)
{
do something;
}
Or must it be:
if(month == 4 ||
You don't specify the language, but if you're using Java then yes, you have do do it the second way, or otherwise use switch:
switch(month) {
case 4:
case 6:
case 9:
case 11:
do something;
}
Alternatively, you might find it useful and cleaner (depending on the design) to not hard-code the values but keep them elsewhere:
private static final Collection MONTHS_TO_RUN_REPORT = Arrays.asList(4, 6, 9, 11);
....
if (MONTHS_TO_RUN_REPORT.contains(month)) {
do something;
}