Scala short <(x: Short): Boolean
Short表示一个16位的有符号整型(相当于Java的short原始类型),是scala.AnyVal的子类。 <(x:Short)方法用于判断此值是否小于x,如果是,则返回true,否则返回false
方法定义: def <(x: Short): Boolean
返回类型: 如果此值小于x,则返回true,否则返回false。
示例 #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
阅读更多:Scala 教程
极客教程