Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Scala Float isValidInt() method with example

  • Last Updated : 29 Oct, 2019

The isValidInt() method is utilized to return true if the specified number is either zero or lies within the range of scala.Int MinValue and MaxValue; otherwise returns false.

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.

Example #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)
      
    }
Output:
true

Example #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)
      
    }
Output:
false

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!