//: Playground - noun:效果图一二对应代码如下
import UIKit
var str = "Hello,playground"
//操作符
// - ++ -- 一元操作符
// +-*/ 二元操作符
// a?b:c 三元操作符
//子增减可以是整数活浮点数
var a = 1.5
var b = a++
var c = ++a
println("a: \(a) b: \(b) c: \(c)")
a+=2//a=a+2
a-=2//a=a-2
//三元操作符
var d = (a < b ? a : b)
//如果a<b 的话 d = a 否则 d = b
//区间操作符
let char_arr = ["a","b","c","d"]
//枚举数组
for i in 0..<char_arr.count
{
println("第\(i)个字符为\(char_arr[i])")
}
//逻辑操作符
let t = true
let f = false
if t&&f
{
println("\(t)&&\(f)")
}
else
{
println("\(t)&&\(f)")
}
if t||f
{
println("\(t)&&\(f)")
}
else
{
println("\(t)&&\(f)")
}
var t_f = !f
if t_f && (t||f)
{
println("\(t_f) \(t) \(f)")
}