scala的方法返回值不需要一定写return,如果有特殊需要也可以写,否则一般情况下最后一行就是方法的返回值
object Test {
def sum(can:Int): Int ={
if(can==0){
return 0
}else{
return 1
}
}
def main(args: Array[String]): Unit = {
println(sum(0))
}
def sum1(a:Int,b:Int):Int ={
a+b
}
}