Write, Run & Share OCaml code online using OneCompiler's OCaml online compiler for free. It's one of the robust, feature-rich online compilers for OCaml language, running on the latest version 4. Getting started with the OneCompiler's OCaml compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as OCaml
. OneCompiler also has reference programs, where you can look for the sampleprograms and start coding.
OCaml is general purpose programming language with more importance to safety and expressiveness. With it's advanced type system, it helps to catch the mistakes in an efficient way. Hence this is used to develop applications/environments where a single mistake can cost millions and speed matters. It has good community support and rich set of development tools and libraries.
Classification | Data types |
---|---|
Basic data types | integers, floating point numbers, booleans, characters, strings |
Sophisticated data types | tuples, arrays, lists, sets, hash tables, queues, stacks, data streams |
OCaml allows users to define new data types.
Variable is a name given to the storage area in order to manipulate them in our programs.
If is performed when you need to choose expression based on a boolean-condition.
While is used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
For loop is used to iterate a set of statements for specific number of items.