title: Pattern matching in a Swift for loop
body: <p>It seems like there should be a "Swiftier" way to do this - but I'm still wrapping my head around the various ways to do pattern matching in Swift.</p>
  
  <p>Suppose I have an Array of AnyObject and I'd like to loop through it and if the item is an Int AND the Int is a multiple of 5, then I'd like to print it out.  Here's my initial approach that works:</p>
  
  <pre><code>let myStuff: [AnyObject] = [5, "dog", 11, 15, "cat"]
  
  for item in myStuff {
      if let myInt = item as? Int where myInt % 5 == 0 {
          print ("\(item)")
      }
  }
  </code></pre>
  
  <p>Honestly, that's not bad...but with all of Swift's pattern matching syntax, it seems like I should be able to consolidate the logic to 1 line.  So far, I haven't found an approach that works - but I was expecting to be able to do something like:</p>
  
  <pre><code>//This doesn't work, but I feel like something similar to this should
  for item in myStuff where item is Int, item % 5 == 0 {
      print ("\(item)")
  }
  </code></pre>
  
  <p>Obviously, this isn't a huge deal - but it's more a thought exercise for me to understand Swift's pattern matching a little better.</p>