类型
和其他语言一样,有 int, float, char, string, bool 等等.
Operations of Type
^ 字符串拼接,*. 浮点数相乘,"xxxxx".[0] 从字符串中取字符
在 OCaml 里判断相等用 = 与 <>,而不用 == 与 !=.
类型转换
<target>_of_<source>类型转换
Assertions
1 | let () = assert (f input1 = output1) |
流程控制
条件语法
1 | if e1 then e2 else e3 |
类型检查:若
Let 语法
1 | let x = e1 in e2 |