def conditions = [ [ range: -100..5, action: warnAboutTemperatreLow ], [ range: 6..29, action: noWarning ], [ range: 30..100, action: warnAboutTemperatreHigh ] ] conditions.find { temperature in it.range }.action()