Scala Double >(x: Long) 方法
在 Scala 中,Double 是一个 64 位浮点数,相当于 Java 的 double 基本类型。如果该值大于 x,则使用>(x: Long)方法返回 true,否则返回 false。
Method Definition – def >(x: Long): Boolean
Returns – Returns true if this value is greater than x, false otherwise.
示例 #1:
// Scala program to explain the working
// of Double >(x: Long) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying >(x: Long) function
val result = (12.00123.toDouble).>(8:Long)
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program to explain the working
// of Double >(x: Long) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying >(x: Long) function
val result = (5.00123.toDouble).>(13:Long)
// Displays output
println(result)
}
}
输出:
false