快学Scala-学习笔记:2.1条件表达式

在Scala中,if/else表达式是有返回值的,例如:

val x = 1
val y = if(x>0) 1 else -1

  

猜你喜欢

转载自www.cnblogs.com/gudanjava/p/10166925.html