Skip to content
Related Articles

Related Articles

Scala Short min() method with example
  • Last Updated : 11 Nov, 2019
GeeksforGeeks - Summer Carnival Banner

The min() method is utilized to find the minimum of the two specified Short types.

Method Definition: def min(that: Short): Short

Return Type: It returns the number of type Short with the minimum value.

Example: 1#




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



998

Example: 2#




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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :