上QQ阅读APP看书,第一时间看更新
Creating our own types
We can also create our types:
type person = (string, int);
/* or */
type name = string;
type age = int;
type person = (name, age);
Here's how we create a person of the person type:
let person = ("Zoe", 3);
We can also annotate any expression with its type:
let name = ("Zoe" : string);
let person = ((name, 3) : person);