From a6b27c3f648f1119cee41aa6352bb08bb0a98412 Mon Sep 17 00:00:00 2001 From: Sanchime Date: Sun, 20 Feb 2022 13:27:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E7=B1=BB=E5=9E=8B=E4=BB=8B=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Basic-practice-of-FSharp/LetBinding.fs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Basic-practice-of-FSharp/LetBinding.fs b/Basic-practice-of-FSharp/LetBinding.fs index b0df1c1..0fdbfb0 100644 --- a/Basic-practice-of-FSharp/LetBinding.fs +++ b/Basic-practice-of-FSharp/LetBinding.fs @@ -28,4 +28,23 @@ let b = 3.1415926 let c = 'a' // s为string类型 -let s = "abc" \ No newline at end of file +let s = "abc" + +// F#还提供了一些集合类型,比如列表, 数组和序列 + +// 列表: [1; 2; 3; 4]或者['a'; 'b'; 'c'; 'd'] +// 列表是一个有序的、不可变的同类型元素系列, 并且以分号分割 + +let list = ["第一个元素"; "第二个元素"; "第三个元素"] + +printfn "%A" list +// 我们将其输出,结果应该为["第一个元素"; "第二个元素"; "第三个元素"] + +// 数组与列表类似, 有序的同元素系列, 不同点是数组是可变的 +// 并且左右两边多了两根竖线 + +let array = [| "数组第一个元素"; "数组第二个元素" |] + +printfn "%A" array + +// 当然也有一些表达某种特定结构的类型,比如元组, 记录, 结构, 类, 接口, 枚举, 可区分联合 \ No newline at end of file