Skip to content
Related Articles

Related Articles

Scala Int isValidByte() method with example

Improve Article
Save Article
  • Last Updated : 30 Jan, 2020
Improve Article
Save Article

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

Method Definition: (Int_Number).isValidByte

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

Example #1:




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


Output:

true

Example #2:




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


Output:

false

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!