-1

I am trying to force unwrap but, it doesn't work. I have also tried a different variant of unwrapping which uses, "let", but I am unable to unwrap it using print.

enter image description here

Note that, the linked answers did not work.

Any thoughts?

4
  • You can show the error with an image but you also have to transcript the error in text Commented Mar 10, 2016 at 14:52
  • just curious, what does transcript the error in text mean? couldn't quiet get it.
    – Josh
    Commented Mar 10, 2016 at 15:04
  • 2
    You have to write in text behind the image, the error text (in this case: "Cannot subscript..."). Imagine the image doesn't load for someone, he'd like to understand the error anyway. Commented Mar 10, 2016 at 15:22
  • why a down vote? come on!
    – Josh
    Commented Mar 10, 2016 at 15:54

1 Answer 1

2

You created an array, to create a dictionary you have to change var dict = ["name: josh", "age: 40", "gender: male"] with var dict = ["name": "josh", "age": "40", "gender": "male"]

2
  • I changed the dictionary, but it still doesn't print(dict["name"]!) in the playground.
    – Josh
    Commented Mar 10, 2016 at 14:58
  • Sorry. Works as a charm. :)
    – Josh
    Commented Mar 10, 2016 at 15:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.