In Java, I can write:
Double x = (x1 > x2)? x1:x2
But this doesn't seem to work in Scala, the following has an error:
var x = (x1 > x2)? x1:x2
I don't feel like writing a block of code for this in Scala:
var x = x2
if (x1 > x2 ) {
x = x1
}
If there a cleaner way for such operation in Scala? Thanks!
According to this and this page you just use the regular if/else syntax: