处理复合数据类型
Flux 复合类型 是由基本类型构造的类型。 Flux 支持以下复合类型:
记录
A record 类型是一组键值对。学习如何在 Flux 中使用 record 类型。
{foo: "bar", baz: 123.4, quz: -2}
{"Company Name": "ACME", "Street Address": "123 Main St.", id: 1123445}
数组
一种 数组 类型是相同类型值的有序序列。学习如何在 Flux 中使用数组。
["1st", "2nd", "3rd"]
[1.23, 4.56, 7.89]
[10, 25, -15]
词典
字典字典类型是一组具有相同类型的键和值的键值对集合。学习如何在Flux中使用字典。
[0: "Sun", 1: "Mon", 2: "Tue"]
["red": "#FF0000", "green": "#00FF00", "blue": "#0000FF"]
[1.0: {stable: 12, latest: 12}, 1.1: {stable: 3, latest: 15}]
函数
A function type is a set of parameters that perform an operation. 学习如何在flux中使用函数。
() => 1
(a, b) => a + b
(a, b, c=2) => {
d = a + b
return d / c
}