Ashish K Agarwal
Ashish K Agarwal

Reputation: 1172

Swift Dictionary is not printing key values

I am new to swift programming. I have written the following code for iterating and printing dictionary

var items_price = [
"milk": 1 ,
"bread" : 3,
"egg" : 2
]

for (myKey, myValue) in items_price {
      println ("\(myKey) costs : \(myValue)")
}

This code is not printing the result as "milk costs: 1" ,etc. What is wrong?

Upvotes: 1

Views: 2122

Answers (1)

Kirsteins
Kirsteins

Reputation: 27335

println statements are printed in timeline of playgrounds. Press the "+" in the circle at the end of print statement line. enter image description here

Upvotes: 3

Related Questions