Please enable JavaScript.
Coggle requires JavaScript to display documents.
OCaml Programming Language (Commands (importing other ocaml modules or…
OCaml Programming Language
Functional language
immutable data structures
based on mathematical functions
Value Oriented Programming
Expressions run to calculate a value (int, string, boolean)
If-then-else
useful way to choose between two different result values based on a boolean condition
let declarations
two declarations can have the same identifier...the most recent identifier will be used
let x = 5
let x = 11
Local identifier: let x = 3 in x + 4
let x = 3
let f = (x : int)
let f = (x : int ) (y : int)
Strongly Typed Language: cannot intermix values with differing data types
Commands
importing other ocaml modules or libraries
running program test cases
Printing to the screen
Commands don't calculate any useful value
;; print_string "hello world"
;; run_test "name of test" (function name)
;;print_endline "Hello, World"