//: Playground - noun: a place where people can play
//声明、定义数组
@H_403_5@var numbers = [1, 2,216)">3,216)"> 5,216)">8]var strings = ["ios","android","java"]
//数组长度
numbers.count
strings.count
//向数组中添加元素
//向数组中追加元素
numbers.append(13)
@H_502_76@strings.append("javascript")
//直接向数组后面添加一个数组
@H_403_5@@H_502_76@numbers += [21,216)">34]@H_502_76@strings += ["jquery","C#"]
//使用index索引添加元素
@H_403_5@@H_502_76@numbers.insert(-0) @H_403_5@@H_502_76@strings.insert("apple",216)">0)//删除数组中得元素
@H_502_76@numbers.removeAtIndex(0)
numbers
@H_502_76@strings.removeAtIndex( strings
//删除数组中最后一个元素
@H_502_76@numbers.removeLast()
@H_502_76@strings.removeLast()
strings
//使用enumerate
@H_403_5@for (index,item) in enumerate(@H_502_76@numbers) { @H_403_5@ println("\(index):\(item)") @H_403_5@} @H_403_5@for item in enumerate(@H_502_76@strings) { @H_403_5@ println("index:\(item.0),值:\(item.1)") @H_403_5@}//创建数组
@H_403_5@var nums = [Int]() @H_403_5@class Admin {@H_403_5@} @H_403_5@var student = [@H_502_76@Admin]()
//创建指定大小数组
@H_403_5@var num2 = [Int](count: 5,repeatedValue: 3)//数组的赋值和拷贝行为
@H_403_5@var num3 = [2,216)"> 3,216)">4,216)"> 5] @H_403_5@var num4 = @H_502_76@num3 @H_403_5@@H_502_76@num3[1] = 100num3
num4
//
@H_403_5@var num5 = @H_502_76@num3