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
I fixed your code for max
To find max, min and avg, using your approach:
But note you can do just: