Board Thread:Questions and Answers/@comment-14600979-20140814170047/@comment-5334617-20140815142318

If you're interested in how to analyze the problem from first principles, using information about the operators like their precedence and associativity, I wrote about it on another thread: http://petitcomputer.wikia.com/wiki/Thread:33208

Analyzing the last  with precedence and associativity shows another problem. Almost all versions of BASIC do not have a separate type for boolean (logical) values, they just use numerical values; SmileBasic is one of these. So, the numerical bitwise NOT has the same operand type as the logical NOT. Many versions of BASIC use -1 as the value for TRUE, so that (for integers at least) both bitwise NOT and logical NOT can be implemented in the same operator. SmileBoom decided to use -1 for, and 1 for. So, the logical NOT  is different from the bitwise NOT.

has a higher precedence than, so the expression   is interpreted as  , i.e.   is logically inverted, then the result goes into. What you want is, the parentheses will make a difference.