gpt4 book ai didi

syntax-error - 完成的单词给我语法错误ocaml?

转载 作者:行者123 更新时间:2023-12-03 08:16:44 24 4
gpt4 key购买 nike

我试图在ocaml中做一会儿做完循环,但是我在第21行(刚说完成的那一行)上有语法错误,我不知道这是什么错误。

let ver = 1 in
while ver > 0 do
let () = Printf.printf "Olá, insere o número de casas que o tabuleiro tem numa linha, separe por um espaço\n" in
let tudo = read_line () in (* Le a linha inserida*)
let ncc = tudo.[0] in (*ncc = Numero de Casas Char*)
let ncs = Char.escaped ncc in (*ncs = Numero de Casas String*)
let nc = int_of_string ncs in (* passa a string para int para termos o numero de casas em int para podermos trabalhar*)
let () = Printf.printf "%d" nc in
let pcc = tudo.[2] in
let pcs = Char.escaped pcc in
let pc = int_of_string pcs in
let () = Printf.printf "%d" pc in
let a1c = tudo.[4] in
let a1s = Char.escaped a1c in
let a1 = int_of_string a1s in
let () = Printf.printf "%d" a1 in
let b1c = tudo.[6] in
let b1s = Char.escaped b1c in
let b1 = int_of_string b1s in
let ver = if (nc < 51 && nc > 0 && pc < 9 && pc > 0 ) then 0 else 1 in
done

最佳答案

您在done之前的最后一行计算ver的值,但是对此不执行任何操作。以in结尾的表达式是没有意义的。

可能是您在in之后缺少表达式。否则,不清楚为什么要计算ver

关于syntax-error - 完成的单词给我语法错误ocaml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58279181/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com