Update comment format of array.swift

pull/217/head
Yudong Jin 2 years ago
parent 73e3452838
commit 230c7723d5

@ -69,34 +69,34 @@ func find(nums: [Int], target: Int) -> Int {
@main @main
enum _Array { enum _Array {
// Driver Code /* Driver Code */
static func main() { static func main() {
// /* */
let arr = Array(repeating: 0, count: 5) let arr = Array(repeating: 0, count: 5)
print("数组 arr = \(arr)") print("数组 arr = \(arr)")
var nums = [1, 3, 2, 5, 4] var nums = [1, 3, 2, 5, 4]
print("数组 nums = \(nums)") print("数组 nums = \(nums)")
// 访 /* 访 */
let randomNum = randomAccess(nums: nums) let randomNum = randomAccess(nums: nums)
print("在 nums 中获取随机元素 \(randomNum)") print("在 nums 中获取随机元素 \(randomNum)")
// /* */
nums = extend(nums: nums, enlarge: 3) nums = extend(nums: nums, enlarge: 3)
print("将数组长度扩展至 8 ,得到 nums = \(nums)") print("将数组长度扩展至 8 ,得到 nums = \(nums)")
// /* */
insert(nums: &nums, num: 6, index: 3) insert(nums: &nums, num: 6, index: 3)
print("在索引 3 处插入数字 6 ,得到 nums = \(nums)") print("在索引 3 处插入数字 6 ,得到 nums = \(nums)")
// /* */
remove(nums: &nums, index: 2) remove(nums: &nums, index: 2)
print("删除索引 2 处的元素,得到 nums = \(nums)") print("删除索引 2 处的元素,得到 nums = \(nums)")
// /* */
traverse(nums: nums) traverse(nums: nums)
// /* */
let index = find(nums: nums, target: 3) let index = find(nums: nums, target: 3)
print("在 nums 中查找元素 3 ,得到索引 = \(index)") print("在 nums 中查找元素 3 ,得到索引 = \(index)")
} }

Loading…
Cancel
Save