Skip to content

Instantly share code, notes, and snippets.

@dangdennis
Created December 1, 2018 03:42
Show Gist options
  • Save dangdennis/baa40ea6df009a0c7e00d8a1c29a401a to your computer and use it in GitHub Desktop.
Save dangdennis/baa40ea6df009a0c7e00d8a1c29a401a to your computer and use it in GitHub Desktop.
/* Compiler error: You can convert a int to a string with string_of_int.*/
let integer10: int = 10;
/* Proper use of typecast methods */
let string10: string = string_of_int(10);
let boolean10: bool = bool_of_string("true");
let float10: float = float_of_int(10);
let integer10Again: int = int_of_float(10.);
let integer5: int = int_of_char('a'); /* Converts character to ASCII decimal equivalent */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment