DEV Community

Andrey Frolov
Andrey Frolov

Posted on

Look into base types

So nothing special here

There are bunch of data types:

  • floats

Numbers with a floating point

1.1
1.2
Enter fullscreen mode Exit fullscreen mode
  • ints
300_000
1
Enter fullscreen mode Exit fullscreen mode

OCaml as ruby, elixir does, allow you to place underscores in the middle of numeric literals to improve readability. Note that underscores can be placed anywhere within a number, not just every three digits.

  • booleans
(1 < 2) = false;;
Enter fullscreen mode Exit fullscreen mode
  • chars
"a";;
Enter fullscreen mode Exit fullscreen mode
  • strings (immutable)
"Hello";;
Enter fullscreen mode Exit fullscreen mode

Oldest comments (1)

Collapse
 
yawaramin profile image
Yawar Amin

Hello, char type uses single quote: 'a'.