Open In App

Scala Float min() method with example

Last Updated : 29 Oct, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads