Swift: Unary operator '++' cannot be applied to an operand of type '@lvalue Int'


Swift error:
Unary operator '++' cannot be applied to an operand of type '@lvalue Int'

Solution:
-- and ++ have been removed from Swift 3.

change to:

var a:Int=0;
a+=1;
print(a)

output:
1

留言