Don\'t know if this is possible, but I have some code like this:
val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) val evens = list.filter { e => e % 2 =
You just write two conditions in the filter:
val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) var result = List(0) val someCondition = true result = if (someCondition) list.filter { e => e % 2 == 0 && e % 3 == 0 } else list.filter { e => e % 2 == 0 && e % 5 == 0 }