在数组中记录用户'输入ocaml,循环语法错误

时间:2018-02-25 13:38:06

标签: arrays ocaml

我正在尝试在数组中记录用户的输入 然而它在说我:

line 5, characters 0-3:
Error: Syntax error

我不明白为什么,因为for的语法似乎没问题 所以这是代码:

let n = read_int()

let ar_of_int = Array.make n 0

for i = 0 to n - 1 do
   let b = read_int ()
   ar_of_int.(i) <- b
done

0 个答案:

没有答案