摘要:
var x= 10if(x>=0){ scala.math.sqrt(x)}else{ throw new IllegalArgumentException("the value should not be negative")}if else表达式的值为res1: Double = 3.16227 阅读全文
摘要:
var list=List("Mary","Tom","Mike")println("***********for 第一种写法************")for(s <-list) println(s)println("***********for 第二种写法************")for{ s 阅读全文
摘要:
def sum(args: Int*) = {var result=0for(arg <- args) result+=arg result}sum(1,2,3) 阅读全文