带有示例的 Scala Float isValidInt() 方法
isValidInt()方法用于在指定数字为零或在 scala.Int MinValue 和 MaxValue 范围内时返回 true;否则返回假。
Method Definition: (Float_Number).isValidInt
Return Type: It returns true if the specified number is either zero or lies within the range of scala.Int MinValue and MaxValue; otherwise returns false.
示例 #1:
// Scala program of Float isValidInt()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isValidInt method
val result = (0).isValidInt
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program of Float isValidInt()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isValidInt method
val result = (5.9).isValidInt
// Displays output
println(result)
}
}
输出:
false