The switch statement in swift in Swift


Without further ado, I directly attached the code to you, as shown below:

 /**
     switch  statements
     */
    let str = "aAbBacdef"
    let str2 = "aAbBadef"
    let str3 = "aAbBadeff"
//    var array = [];
    for c in ["A", "a", str3]
    {
      switch c {
//      case "a":
      case "a", "A":
        print("ldd")

      //  There must be
      default:
        print("dd")
      }
    }
    /**
     case "a":
     case "A":
     print("ldd")
      in  C In the language,   This writing   No matter meet  a A  Will perform  print("ldd") ;
      in  Swift This is not allowed in China , But you could write it like this
     case "a", "A":    The middle is separated by commas
     */
//    switch value {
//    case pattern:
//      code
//    default:
//      code
//    }
    /**
     c  In the language
     case  The following is a  break ;
      If I forget to write break .   The following statements are executed sequentially until executed break ;
      but swift Language is seeing this 1 Just click, no break . To compare case After the conditions inside,
      After executing the following statement, it exits automatically   the switch The statement.
      If you want to continue   with fallthrough
     */