Skip to content

Commit

Permalink
feat: add Swift codes for data_and_memory article
Browse files Browse the repository at this point in the history
  • Loading branch information
nuomi1 committed Jan 5, 2023
1 parent fd3eaaf commit e9fc6b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/chapter_data_structure/data_and_memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ comments: true
bool[] booleans = new bool[5];
```

=== "Swift"

```swift title=""
// 使用多种「基本数据类型」来初始化「数组」
let numbers = Array(repeating: Int(), count: 5)
let decimals = Array(repeating: Double(), count: 5)
let characters = Array(repeating: Character("a"), count: 5)
let booleans = Array(repeating: Bool(), count: 5)
```

## 计算机内存

在计算机中,内存和硬盘是两种主要的存储硬件设备。「硬盘」主要用于长期存储数据,容量较大(通常可达到 TB 级别)、速度较慢。「内存」用于运行程序时暂存数据,速度更快,但容量较小(通常为 GB 级别)。
Expand Down

0 comments on commit e9fc6b3

Please sign in to comment.