web | Java

Scala中的to和until 有什么区别?

千锋教育

例如1to10,它会返回Range(1,2,3,4,5,6,7,8,9,10),而1until 10 ,它会返回Range(1,2,3,4,5,6,7,8,9) 也就是说to包头包尾,而until 包头不包尾!