官术网_书友最值得收藏!

  • ReasonML Quick Start Guide
  • Raphael Rafatpanah Bruno Joseph D'mello
  • 70字
  • 2021-07-02 12:34:14

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);
主站蜘蛛池模板: 湛江市| 江城| 鸡西市| 涟源市| 任丘市| 平阴县| 营口市| 宜兰市| 白山市| 崇阳县| 斗六市| 台江县| 巫溪县| 华池县| 汉中市| 北流市| 灌阳县| 武隆县| 三门峡市| 桐柏县| 休宁县| 靖安县| 和政县| 时尚| 神农架林区| 黄石市| 沙湾县| 板桥市| 抚州市| 清丰县| 丁青县| 滦平县| 库尔勒市| 阜城县| 南城县| 金川县| 凤凰县| 连城县| 宣城市| 开化县| 西华县|