Working with Options in Scala and Play Framework, is there a more concise way of checking x amount of variables like so?
if (a.isDefined || b.isDefined || c.isDefined || d.isDefined ...) {
}
Is a one liner something like (a,b,c,d).isDefined
possible?
Thanks
On top of my head, probably there's a nicer way:
For
and
s (from Rob Starling comment):You could also have more complex condition compositions:
And so on.
Considering that you seem to be within the playframework and that you probably not only want to check whether the / or a value is defined but also use them, you could use the following code using the type classes of the play framework without using scalaz.
On an aesthetic basis:
I could do that all day.
Yup, just checking that I could do it all day.