How can I use swift in Terminal?

后端 未结 13 592
北荒
北荒 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 15:54

    Step 1: Open Terminal
    Step 2: Type "swift"
    Step 3: There's no step 3

    Example:

    GoldCoast:~ macmark$ swift
    Welcome to Swift!  Type :help for assistance.
      1> println("Hello, world")
    Hello, world
      2> var myVariable = 42
    myVariable: Int = 42
      3> myVariable = 50
      4> let myConstant = 42
    myConstant: Int = 42
      5> println(myVariable)
    50
      6> let label = "The width is "
    label: String = "The width is "
      7> let width = 94
    width: Int = 94
      8> let widthLabel = label + String(width)
    widthLabel: String = "The width is 94"
      9> :exit
    
    GoldCoast:~ macmark$ 
    

提交回复
热议问题