📜  Scala Int min() 方法与示例

📅  最后修改于: 2022-05-13 01:54:33.233000             🧑  作者: Mango

Scala Int min() 方法与示例

min()方法用于返回两个指定 int 数的最小值。

Method Definition: (First_Number).min(Second_Number)Return 
Type: It returns true the minimum value of the two specified int numbers.

示例 1:

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


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


输出:
5

示例 2:

斯卡拉

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