Xcode 6 Beta / Swift - Playground not updating

前端 未结 4 1073
天涯浪人
天涯浪人 2021-02-13 06:12

I was playing around with the Playground feature of Xcode 6\'s first beta - and I notice half the time the Playground doesn\'t update (simply doesn\'t display the result calcula

4条回答
  •  自闭症患者
    2021-02-13 06:51

    You have to be very careful with swift. the language is very case sensitive so while using playground make sure all things are spaced out. The following code will NOT give you a syntax error but it will stop processing the rest of your code in playground :

    for index in 1...5 {
        if index %2 !=0{
        continue
        }
    println(index)
    }
    

    The error in the code above is in line 2. The code has to be written

        for index in 1...5 {
           if index % 2 != 0 {
           continue
           }
        println(index)
        }
    

    Hope that answers your question :)

提交回复
热议问题