Search code examples
xcodeswift-playground

playground settings in Xcode


when I run this small code, I don't see the result. All I see is: (11 times)

var name = "Karthik"

for x in 0...10 {
    print(name)
}

How can I display the result individually?


Solution

  • Initially it looks like this Initially it looks like this

    Select the quick look icon Select the quick look icon

    It opens a pop up, you'll see one value, right click it on it and select value history It opens a pop up, you'll see one value, right click it on it and select value history

    YOu'll see the list of values and can scroll through it YOu'll see the list of values and can scroll through it

    OR

    Try to use the other option with an eye like icon called show result. Click on it Try to use the other option with an eye like icon called show result. Click on it

    You'll see that the result popped itself on the playground editor. You'll see that the result popped itself on the playground editor.

    Right click on the pop up which is now sitting in the playground editor and select value history Right click on the pop up which is now sitting in the playground editor and select value history

    YOu'll see the list of values and can scroll through it YOu'll see the list of values and can scroll through it

    HOPE THIS HELPS :)