Scala Float isWhole() method with example
Last Updated :
29 Oct, 2019
The isWhole() method is utilized to return true if the specified number is not having any decimal component, otherwise it returns false.
Method Definition: (Float_Number).isWhole
Return Type: It returns true if the specified number is not having any decimal component, otherwise it returns false.
Example #1:
object GfG
{
def main(args : Array[String])
{
val result = ( 5 ).isWhole
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val result = ( 5.9 ).isWhole
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...