Why does Swift 2.0 print out last element in array instead of all elements?

后端 未结 1 1734
梦毁少年i
梦毁少年i 2021-01-29 06:29

I\'m trying to print out all the elements in this array, and when I display it, it only prints out Pickup laundry.

var todo = [\"Return Calls\", \"Write blog\",          


        
相关标签:
1条回答
  • 2021-01-29 06:49

    I copied your code and pasted it into an app. I ran the app. I saw this in the console:

    Return Calls
    Write blog
    Cook Dinner
    Pickup laundry
    

    So I conclude that either you are lying — that is not your code, or that is not what is printed — or you don't know how to test (e.g. you don't know how to read the console or you're in a playground and you don't understand where the console is).

    0 讨论(0)
提交回复
热议问题