title: Cannot assign to property: 'card' is a 'let' constant in a for loop in swift
body: <p>Cannot assign to property: 'card' is a 'let' constant in for loop in chooseCard method. I am not able to figure out why the error is coming in the for loop .what am I missing in the code .Please help.</p>
  
  <pre><code>import Foundation
  
  class Concentration {
  
      var cards = [Card]()
  
      var faceUpCount = 0
  
      func chooseCard(atIndex : Int) {
          var alreadyFaceUpCard  = Card()
          if faceUpCount == 0 {
              alreadyFaceUpCard = cards[atIndex]
              alreadyFaceUpCard.isFaceUp = true
              faceUpCount += 1
          }else if faceUpCount == 1 {
              var card = cards[atIndex]
              card.isFaceUp = true
              if alreadyFaceUpCard.identifier == card.identifier {
                  alreadyFaceUpCard.isMatchUp = true
                  card.isMatchUp = true
                  faceUpCount += 1
              }
  
          }else {
              for card in cards {
                  card.isFaceUp = false
              }
  
          }
  
      }
  
  
  
      init(numberOfPairsOfCards : Int) {
          for _ in 1...numberOfPairsOfCards {
              let card = Card()
              cards.append(card)
              cards.append(card)
          }
          // TODO: Shuffle Cards
      }
  
  
  }
  </code></pre>