Operators can be used to form expressions. OCaml has more or less all the usual operators you would expect in a language from the C or Java family of languages. See the table of all operators in the OCaml manual for details.
Here are two things to watch out for as you begin:
OCaml deliberately does not support operator overloading. As a consequence, the integer and floating-point operators are distinct. E.g., to add integers, use
+. To add floating-point numbers, use
There are two equality operators in OCaml,
==, with corresponding inequality operators
<>examine structural equality whereas
!=examine physical equality. Until we've studied the imperative features of OCaml, the difference between them will be tricky to explain. (See the documentation of
Pervasives.(==)if you're curious now.) But what's important now is that you train yourself only to use
=and not to use
==, which might be difficult if you're coming from a language like Java where
==is the usual equality operator.