Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Scala everything is an expression so you just use an if statement:

    val foo = if(x) y else z


Thanks. It makes sense because it doesn't have statement. Ternary operator wasn't going to be possible.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: