Day5.switch / it must contains all conditions ,it need delete break and {}

 

//                                      **Day5

//                                      **array / dictionary

 

//let colors = ["redColors":(red:93,green:138,blue:168),

//              "Gam44444":(red:98,green:111,blue:13),

//              "Aboutblue":(red:111,green:1,blue:122),

//              "Aboutblue2":(red:111,green:1,blue:12),

//              "Aboutblue3":(red:211,green:1,blue:122),

//              "Aboutblue1":(red:111,green:11,blue:22)

//             ]

//var bgview = UIView(frame:CGRectMake(0.0,0.0,320.0,CGFloat(colors.count * 50)))

//

//bgview.backgroundColor = UIColor.whiteColor()

//bgview

//

//var index = 0;

//for(coloName,rgbType) in colors

//{

//    var colorStripe = UILabel(frame:CGRectMake(0.0,CGFloat(colors.count*50+5),320.0,50))

//    colorStripe.backgroundColor = UIColor(red: CGFloat(rgbType.red)/255.0,green:CGFloat(rgbType.green)/255.0,blue:CGFloat(rgbType.blue)/255.0,alpha:1.0)

//    colorStripe.textAlignment = NSTextAlignment.Center

//    colorStripe.text = coloName + "111111"

//    colorStripe.textColor = UIColor.redColor()

//    bgview.didAddSubview(colorStripe)

//    

//}

//

//bgview

//

//

 

//for i in -99...99

//{

//    i*i

//}

//

//

//let arr = ["HEllo","world","lst"]

//for c in arr

//{

//    print(c)

//}

//

//let dic = ["int":1,"inta":2,"int3":3]

//for item in dic

//{

//    print("item \(item)")

//}

//for (index,item) in dic

//{

//    print("\(index): \(item)")

//}

 

//let base = 2

//let sque = 10

//var result = 1

//for i in 1...sque

//{

//    result *= base

//}

//result

 

//for var i = -100; i <= 100 ; i += 1

//{

//    print("i")

//    i*i

//}

 

 

//for var i = -0.6 ; i <= 6.6 ; i += 0.2

//{

//    sin(i)

//    cos(i)

//    tan(i)

//}

//

//let number  = arc4random()%10

//

//print("number :\(number)")

//

 

//var rating = "z"

//switch rating

//{

//case "a","A":

//    print("it 's A")

//case "B","b":

//    print("it's B")

//default:

//    print("it's other word: \(rating)")

//}

//

//let coordinate = (3.0,2.1)

//

//switch coordinate

//{

//case (_,5...6):

//    print("it's conditional A")

//case (1...1.1,-2...2):

//    print("it's B")

//case let (s,a) where s==a:

//    print("a isEqual b")

//case let(a,b) where a != b:

//    print("it's u")

//default:

//    print("no")

//}

//

//let courseInfo = ("3-3","一凡要变聪明点哦")

//let astr = "3-3"

//switch courseInfo

//{

//case (let infoName,let courseName) where infoName.hasPrefix("13") || courseName.hasSuffix("点哦"):

//    print("A")

//case (_,let name) where name.hasSuffix("点哦"):

//    print("B")

//default:

//    print("other")

//}

 

 

//if you use switch to judge the workStatus  , it must contains all the condition

posted on 2016-04-04 20:22  Tony0571  阅读(122)  评论(0编辑  收藏  举报

导航