Translate boolean flags to collection of numbers in scala
You could use tuples to pair your flags with an Int. Throw those into a Seq and then perform a filter and then a map on that Seq. Here is how that would look:

def f(a: Boolean, b: Boolean, c: Boolean): Seq[Int] = {

 val xs = Seq((a, 2), (b, 7), (c, 12))

 xs.filter(t =&gt; t._1).map(t =&gt; t._2) 

}


Note that in Scala you don't need to use a return statement as long as the last bit of code in your function returns a new value.