Besides lambdas, there is the Separation of Behaviors DP.
But you really only want to use either option if you need to execute the same code from multiple rules.
Finally, you can have as many else if statements as you want. Switch is a good alternative but not as common in the examples.
A normal usage would be something like:
switch(someString){
case "Foo": {
// Do stuff when someString == Foo
}
case "bar": {
// Do bar stuff
}
default: {
// Do stuff when no offer other case matches
}
}
You can have as many cases as you want. The Rules DSL, unlike most other languages, let’s you put arbitrary conditionals in the case. So you can have a case like:
case some value == ”Foo" && otherValue.length > 3: {
// Do stuff
}