diff options
author | Daniil Baturin <daniil@baturin.org> | 2014-09-11 21:40:15 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2014-09-11 21:40:15 +0700 |
commit | 15fd51c9984fcadcfa83658ae0f01e4b3402c07f (patch) | |
tree | 0ad22f032d46bd92bbf7f555ae983de09c07ccc0 | |
parent | 791c123ba55d726df3da03115a56657b02a02e6f (diff) |
Minor style notes in the OCaml tutorial.
-rw-r--r-- | ocaml.html.markdown | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ocaml.html.markdown b/ocaml.html.markdown index 5c236b1a..7f4e0a9d 100644 --- a/ocaml.html.markdown +++ b/ocaml.html.markdown @@ -59,11 +59,19 @@ written in curried form. (* Expressions can be separated by a double semicolon symbol, ";;". In many cases it's redundant, but in this tutorial we use it after - every expression for easy pasting into the interpreter shell. *) + every expression for easy pasting into the interpreter shell. + Unnecessary use of expression separators in source code files + is often considered to be a bad style. *) (* Variable and function declarations use "let" keyword. *) let x = 10 ;; +(* OCaml allows single quote characters in identifiers. + Single quote doesn't have a special meaning in this case, it's often used + in cases when in other languages one would use names like "foo_tmp". *) +let foo = 1 ;; +let foo' = foo * 2 ;; + (* Since OCaml compiler infers types automatically, you normally don't need to specify argument types explicitly. However, you can do it if you want or need to. *) let inc_int (x: int) = x + 1 ;; |