Scala Long <=(x: Char) 方法
在 Scala 中,Long 是一个 64 位有符号整数,相当于 Java 的 long 原始类型。如果该值小于或等于 x,则使用<=(x: Char)方法返回 true,否则返回 false。
Method Definition – def <=(x: Char): Boolean
Returns – Returns true if this value is less than or equal to x, false otherwise.
示例 #1:
// Scala program to explain the working
// of Long <=(x: Char) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying <=(x: Char) function
val result = (65.toLong).<=('A':Char)
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program to explain the working
// of Long <=(x: Char) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying <=(x: Char) function
val result = (75.toLong).<=('G':Char)
// Displays output
println(result)
}
}
输出:
false