mirror of
https://github.com/krahets/hello-algo.git
synced 2025-02-03 07:01:55 +08:00
Merge pull request #207 from nuomi1/feature/data_and_memory-Swift
feat: add Swift codes for data_and_memory article
This commit is contained in:
commit
7f72b273e4
@ -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 级别)。
|
||||
|
Loading…
Reference in New Issue
Block a user