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