title: How to update a value in core data?
body: <p>I am trying to update a flashcards score every time it the flash card is studied, but the score isn't saving. What am I doing wrong?</p>
  
  <pre><code>do {
  
      fetchedCards = try context.fetch(Cards.fetchRequest())
  
      for cards in fetchedCards {
          if(termLabel.text == cards.term){
              cards.score = score
              ad.saveContext()
              continue
          }
      }
  
  } catch {
  
  }
  
  
  let ad = UIApplication.shared.delegate as! AppDelegate
  let context = ad.persistentContainer.viewContext
  </code></pre>