I know in F# we should bind every single value to a name. And I think mine is ok???
But in the if statement I have the following error.
Block following this 'let' is unfinished. Expect an expression
and it comes from let min= List.nth list i
.
As far as I know I bounded the min to List.nth list i
. So why it should be an error?
let mutable list =[-1;2;3;4]
let mutable min=list.[0]
let mutable i=1
if min<=0 then let min= List.nth list i
If you want to mutate a mutable variable, you can use the
<-
operator:But this is not a very functional approach. A better method is to define a new value: