Import FOUNDATION//4, compound assignment operator var a = 1a + = 2//unary decrement operator (a numeric value before a symbol-called unary minus operator) let three = 3let Minusthree =-three//minusthree = -3let Plusthree =-minusthree//plusthree = 3//unary plus operator (unary plus operator (+) return value, no change) let Minussix = 6let Alsominussix = +minussix Alsominussix = 6//6, ternary conditional operator//Special NOTE: three-mesh operator (?) There must be at least one space in front of let Contentheight = 40let rowHeight = contentheight + (Contentheight > 20? 50:20)//7, range operator//enclosing range operator (includes a and b) for index in 1...5 { print ("\ (index) times 5 is \ (Index * 5)")}//semi-enclosed area operator (header not covered tail) let names = ["Anna", "Alex", "Brian "," Jack "]let count = names.countfor i in 0..<count{ print (" Person \ (i) is called \ (Names[i]) "}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The Swift tutorial operator