Scala short <=(x: Short): Boolean
Short是一个16位有符号整数(相当于Java的short原始类型),是scala.AnyVal的一个子类型。利用<=(x: Short)方法,如果该值小于或等于x,则返回真,否则返回假。
方法定义:def <=(x: Short): Boolean
返回类型。如果这个值小于或等于x,则返回真,否则返回假。
例子 #1:
// Scala program of Short <=(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short <=(x: Short) function
val result = (998.toShort).<=(999:Short)
// Displays output
println(result)
}
}
输出。
True
例子#2。
// Scala program of Short <=(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short <=(x: Short) function
val result = (102.toShort).<=(101:Short)
// Displays output
println(result)
}
}
输出。
false
极客教程