Scala 短 <(x: Long): 布尔值
简而言之,一个 16 位有符号整数(相当于 Java 的 short 原始类型)是 scala.AnyVal 的子类型。如果该值小于 x,则使用 <(x: Long) 方法返回 true,否则返回 false。
Method Definition: def <(x: Long): Boolean
Return Type: It returns true if this value is less than x, otherwise false.
示例 #1:
// Scala program of Short <(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short <(x: Long) function
val result = (998.toShort).<(999:Long)
// Displays output
println(result)
}
}
输出:
True
示例 #2:
// Scala program of Short <(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short <(x: Long) function
val result = (102.toShort).<(101:Long)
// Displays output
println(result)
}
}
输出:
false