Open In App

Scala Int isValidLong() method with example

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

Method Definition: (Int_Number).isValidLong



Return Type: It returns true if the specified number is either zero or lies within the range of scala.long MinValue and MaxValue; otherwise returns false.

Example #1:




// Scala program of Int isValidLong()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying isValidLong method
        val result = (0).isValidLong
          
        // Displays output
        println(result)
      
    }

Output:

true

Example #2:




// Scala program of Int isValidLong()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying isValidLong method
        val result = (5).isValidLong
          
        // Displays output
        println(result)
      
    }

Output:
true

Article Tags :