Scala Int isWhole() method with example
Last Updated :
30 Jan, 2020
The isWhole() method is utilized to return true if the specified int number is not having any decimal component, otherwise, it returns false.
Method Definition: (Int_Number).isWhole
Return Type: It returns true if the specified int 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.0 ).isWhole
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...