How can I use swift in Terminal?

后端 未结 13 599
北荒
北荒 2020-11-29 15:28

I read What\'s new in Xcode 6. The article introduces some new feature about Xcode 6, and it says:

Command Line

Xcode’s debugger includes an inter

13条回答
  •  暖寄归人
    2020-11-29 16:03

    With the help of Swift REPL(Read Eval Print Loop).

    Developers familiar with interpreted languages will feel comfortable in this command-line environment, and even experienced developers will find a few unique features

    Launch Terminal.app and type swift and press enter. You’ll then be in the Swift REPL.

            1> print("Hello Swift REPL")
         Hello Swift REPL
            2> 10 + 20
         $R0: Int = 30
            3> var name = "Yogendra Singh"
         name: String = "Yogendra Singh"
            4> print(name)
         Yogendra Singh
            5>
    

提交回复
热议问题