Swift 入門指南 V1.00 - 單元 4 範例




CH04.playground


var a:Int, b:Int, c:Int, d:Int, e:Int, f:Int

a = -3
b = +a
c = -a

a = 3
b = ++a
c = a++
d = --a
e = a--

var a2:Bool, b2:Bool, c2:Bool

a2 = true
b2 = !a2
c2 = !b2

a = 11
b = a + 2
c = b - 2
d = c * 2
e = d / 2
f = e % 2

a = 11; b = 22
var c3 = a >= b
var d3 = a <= b
var e3 = c == d
var f3 = a != b

a = 12
a += 3
a -= 3
a *= 3
a /= 3
a %= 3

the end

沒有留言: