循环语句
// main.swift // L001for // // Created by hins on 16/10/26. // Copyright © 2016年 hins. All rights reserved. // import Foundation print("Hello,World!") //循环 //数组循环 var arr:[Int] = Array(); for item in 1...100{ arr.append(item); //print("=======") } print(arr.count) for (i,value) in EnumerateSequence(arr){ print("\(i+1)======\(value)"); } var n=0; while n<arr.count{ print("\(n),\(arr[n])"); n = n+1; } //字典循环 var dict:Dictionary<Int,String> = Dictionary(); for i in 1...10{ dict[i]="aaa\(i)"; } for (key,value) in dict{ print("\(key),\(value)"); }