1. 代码示例
//: Playground - noun: a place where people can play
import Cocoa
//赋值运算符
let name = "Hello World"
print(name+"\n")
//数值运算符
var num1 = 3
var num2 = 1
var sum = num1 + num2
print(sum)
//比较运算符
if(num1 > num2){
print("The bigger number is \(num1)")
}else{
print("The bigger number is \(num2)")
}
//三目运算符
let num3 = 100
let num4 = 200
var biggerNum = num3 > num4 ? num3 :num4
print(biggerNum)
2. 运行结果