I am attempting a code sample in Lesson 5, Step 6 of the Try Ocaml tutorial
We were supposed to fix this code sample:
let one =
let accum = ref -54 in
for i = 1 to ten do accum := !accum + i done ;
!accum
and here is my attempt:
let one =
let accum = ref -54 in (
for i = 1 to 10 do
accum := accum + i
done
;
!accum
)
but unfortunately I am receiving the error message:
line 2, characters 14-17: Error: This expression has type 'a -> 'a ref but an expression was expected of type int