elect
06/02/2017, 7:56 AMif - else
with the code indented based on the position of the if
?
val list = if(student != null && student.passing)
getListForStudent(student)
else
getStandardList()
marcinmoskala
06/02/2017, 10:18 AMwhen
to be used in this kind of situations:
val list = when {
student != null && student.passing -> getListForStudent(student)
else -> getStandardList()
}
elect
06/02/2017, 10:37 AMcedric
06/02/2017, 4:07 PMif
on a different line myself:
val a =
if (foo) 1
else 2
It's the best I've found so far