title: Swift : Error when trying to assign value to a Class object >> execution was interrupted reason exc_bad_instruction (code=exc_i386_invop subcode=0x0)
body: <p>I'm new to swift and programming , I am trying to understand this code below but I keep getting this error <strong><em>>>> execution was interrupted reason exc_bad_instruction (code=exc_i386_invop subcode=0x0)</em></strong> from playground. I thought I could simply assign x with class Product() and fill in the values, but I don't understand what the error is saying. Can someone please explain to me? How can I use this Class Product ? </p>
  
  <pre><code>class Product
  {
      var title: String
      var description: String
      var image: UIImage
      var rating: ProductRating
  
      init(titled: String, description: String, imageName: String)
      {
          self.title = titled
          self.description = description
          if let img = UIImage(named: imageName) {
              image = img
          } else {
              image = UIImage(named: "default")!
          }
          rating = .Unrated
      }
  }
  
  var x = Product(titled: "test", description: "test", imageName: "test.jpg")
  </code></pre>