- Home /
In Javascript, can I reverse a boolean as so: boolean = !boolean
Hello, I'm trying to reverse a boolean using testVar = !testVar;
and it isn't working. Is this possible in UnityScript (Javascript)? If not, is there a somewhat similar way to switch between true or false, or do I have to use an if statement?
Thanks
Comment
Best Answer
Answer by Jessy · Jan 03, 2011 at 01:03 AM
Yes, but you can't name a variable var. It's a keyword.
It was just for the example :) I'll change it though. This means my problem is somewhere else, thanks a lot for the tip.
it doesn't matter, as long as the v is capital, it won't recognize it, allowing you to say stuff like: fireVar or liteVar but you can't say test var.