val a = List(1, 2, 3, 4)
val b = 0 :: a
而不能写成这样
val a = List(1, 2, 3, 4)
val b = a :: 0
val b = 0 :: a
而不能写成这样
val a = List(1, 2, 3, 4)
val b = a :: 0
2017-11-06
http://www.slideshare.net/Odersky/oscon-keynote-working-hard-to-keep-it-simple
2017-10-25
var i = 1
//var s = " "
def main(args: Array[String]) {
i = jie(5,1)
println(i)
}
@annotation.tailrec
def jie (n:Int,m:Int): Int ={
if(n <= 0) m
else{
jie(n -1,m*n)
}
}
//var s = " "
def main(args: Array[String]) {
i = jie(5,1)
println(i)
}
@annotation.tailrec
def jie (n:Int,m:Int): Int ={
if(n <= 0) m
else{
jie(n -1,m*n)
}
}
2017-10-12