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