带有示例的 Scala Float min() 方法
min()方法用于返回两个指定浮点数的最小值。
Method Definition: (First_Number).min(Second_Number)
Return Type: It returns the minimum value of the two specified float numbers.
示例 #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)
}
}
输出:
5.9
示例 #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)
}
}
输出:
5.0