title: Using break statement in switch
body: <p>Following is the given example for using break statements in switch: </p>
  
  <pre><code>let numberSymbol: Character = "三"  // Simplified Chinese for the number 3
  var possibleIntegerValue: Int?
  switch numberSymbol {
  case "1", "١", "一", "๑":
      possibleIntegerValue = 1
  case "2", "٢", "二", "๒":
      possibleIntegerValue = 2
  case "3", "٣", "三", "๓":
      possibleIntegerValue = 3
  case "4", "٤", "四", "๔":
      possibleIntegerValue = 4
  default:
      break
  }
  if let integerValue = possibleIntegerValue {
      println("The integer value of \(numberSymbol) is \(integerValue).")
  } else {
      println("An integer value could not be found for \(numberSymbol).")
  }
  </code></pre>
  
  <p>The <code>possibleIntegerValue</code> is <code>optional Int</code>, so I really don't find this as a better example of using breaks in switch. Instead of break, even <code>possibleIntegerValue = nil</code> also works.</p>
  
  <pre><code>let numberSymbol: Character = "三"  // Simplified Chinese for the number 3
  var possibleIntegerValue: Int?
  switch numberSymbol {
  case "1", "١", "一", "๑":
      possibleIntegerValue = 1
  case "2", "٢", "二", "๒":
      possibleIntegerValue = 2
  case "3", "٣", "三", "๓":
      possibleIntegerValue = 3
  case "4", "٤", "四", "๔":
      possibleIntegerValue = 4
  default:
      possibleIntegerValue = nil
  }
  if let integerValue = possibleIntegerValue {
      println("The integer value of \(numberSymbol) is \(integerValue).")
  } else {
      println("An integer value could not be found for \(numberSymbol).")
  }
  </code></pre>
  
  <p>So in this case <code>break</code> is not required at all. Can anyone give me a proper example of using breaks in switch, where I purposely have to ignore some cases?</p>
  
  <p>The book says:</p>
  
  <blockquote>
    <p>This behavior can be used to match and ignore one or more cases in a
    switch statement. Because Swift’s switch statement is exhaustive and
    does not allow empty cases, it is sometimes necessary to deliberately
    match and ignore a case in order to make your intentions explicit. You
    do this by writing the break statement as the entire body of the case
    you want to ignore. When that case is matched by the switch statement,
    the break statement inside the case ends the switch statement’s
    execution immediately.</p>
  </blockquote>