Open In App

Scala Float min() method with example

The min() method is utilized to return the minimum value of the two specified float numbers.

Method Definition: (First_Number).min(Second_Number)



Return Type: It returns the minimum value of the two specified float numbers.

Example #1:




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

Output:

5.9

Example #2:




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

Output:
5.0

Article Tags :