Find maximum, minimum and average in F#
问题 I want to find maximum, minimum and average in an array without .NET in F#. I used this code but it is not working: 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 回答1: I fixed your code for max let mutable max = 0 let arrX= [|9; 11; 3; 4; 5; 6; 7; 8|] for i in 0 .. arrX.Length - 1 do if max < (arrX.[i]) then max <- arrX.[i] printfn "%i" max To find max, min and avg, using your