从 Julia 中的列表中获取最小值 – min() 方法
min()
是 julia 中的一个内置函数,用于返回参数的最小值。
Syntax: min(x, y, …)
Parameters:
- x: Specified 1st value.
- y: Specified 2nd value and so on.
Returns: It returns the minimum value of the parameters.
示例 1:
# Julia program to illustrate
# the use of min() method
# Getting the minimum value of the parameters.
println(min(1, 2, 3, 4))
println(min(1, 3, 5))
println(min(2, 4, 6))
输出:
1
1
2
示例 2:
# Julia program to illustrate
# the use of min() method
# Getting the minimum value of the parameters.
println(min(0.6, 0.7, 0.2))
println(min(2.5, 3.5, 0.3, 1.7))
输出:
0.2
0.3