类似于java的assert,可以对函数参数进行限制。
用法如下:
def sqrt(x: Int) = { | require(x >= 0, "input must > 0!") | math.sqrt(x) | }