0

Postfix increment is not supported in Swift 3, isn't it?

Here is what I've got after running the code ---------- var a = 3 let b = a++ let c = -b print (c) ---------- in online sandbox: ERROR at line 5, col 10: '++' is unavailable: it has been removed in Swift 3 let b = a++ ^~ += 1

14th Oct 2016, 10:49 AM
Muslim Sattarov
Muslim Sattarov - avatar
2 Antworten
0
Yes. Increment and decrement operators are not supported in Swift 3. Instead of ++, you need to write += and instead of -- you need to write -=
22nd Oct 2016, 9:38 AM
Rajesh Kumar
Rajesh Kumar - avatar
0
Strange, because those operators are universal (php, c++, js)
9th May 2019, 4:24 PM
Muslim Sattarov
Muslim Sattarov - avatar