zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Map使用总结
    AutoReleasePool使用总结
    UIImage使用总结
    Subversion简明手册--使用hook svn
    转:MyEclipse8.6插件安装方法
    转:myeclipse 8.x 插件安装方法终极总结
    如何通过类找到对应的jar包
    关于更改MYECLIPSE JS 代码背景颜色
    win7 64位系统下 PL/SQL无法连接的问题
    Windows7(x64)下Oracle10g安装
  • 原文地址:https://www.cnblogs.com/tony0571/p/5352782.html
Copyright © 2011-2022 走看看