Open In App

Scala Int isValidShort() method with example

Last Updated : 30 Jan, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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

Method Definition: (Int_Number).isValidShort

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

Example #1:




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


Output:

true

Example #2:




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


Output:

true


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads