I am getting error message:
prefix/postfix '=' is reserved
for below simple in swift.
var c=0,a=2,b=4
c= a+b
any idea why I am getting this error?
Check this: Is this response from the compiler valid?
Swift isn't entirely whitespace-agnostic like C... in particular, it uses whitespace to distinguish prefix from postfix operators (because ++i++ in C is a grammar oddity). But it's not ridiculously strict about whitespace like Python either.
P.S. So you have to add whitespace before =.
If I use a single space after variable "c" name, this error is get removed.
c = a+b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With