小编Car*_*ANG的帖子

为什么我的 OCaml“=”运算符仅适用于 int?

我使用 vscode,带有“OCaml 和 Reason IDE”的扩展

这是我在 utop 中的结果:

utop # 1. = 1. ;;    
Line 1, characters 0-2:
Error: This expression has type float but an expression was expected of type
             int
Run Code Online (Sandbox Code Playgroud)

对于字符串也同样如此:

utop # "Me" = "Me";;
Line 1, characters 0-4:
Error: This expression has type string but an expression was expected of type
         int
Run Code Online (Sandbox Code Playgroud)

除 int 之外的任何内容都相同:

utop # 2 = 2 ;;
- : bool = true
Run Code Online (Sandbox Code Playgroud)

">" "<" 也有同样的症状。我不知道到底发生了什么。谁能帮我吗 ?多谢!

ocaml utop

2
推荐指数
1
解决办法
685
查看次数

标签 统计

ocaml ×1

utop ×1