小编Mas*_*oud的帖子

查找F#中的最大值,最小值和平均值

我想在F#中找到没有.NET的数组中的最大值,最小值和平均值.我使用了这段代码,但它没有用:

let mutable max = 0
let arrX = [|9; 11; 3; 4; 5; 6; 7; 8|]

for i in 0 .. arrX.Length - 2 do
  if (arrX.[i]) < (arrX.[i+1]) then 
       max <- arrX.[i]
       printfn "%i" max
Run Code Online (Sandbox Code Playgroud)

f# f#-interactive

5
推荐指数
2
解决办法
5290
查看次数

标签 统计

f# ×1

f#-interactive ×1