Not operator

This topic is 3656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi there, i've upgraded to version 2.14.1 and noticed that the not (!) operator is no longer working in if statements. I always get "Expected expression value" errors. Is it just a config thing or has the parser changed? Thanks, Tim

Share on other sites
The not operator should still be working. Can you give me an example of where it doesn't work?

Regards,
Andreas

Share on other sites
A simple example is the following:

class Test{    bool isTrue() { return true; }    void test()     {         if ( !isTrue() )            print("false");         else             print("true");     }}Test t;

I can rewrite the if statement to get it working:
class Test{    bool isTrue() { return true; }    void test()     {         if ( isTrue() != true )            print("false");         else             print("true");     }}Test t;

Regards,
Tim

Share on other sites
This should work
if ( !( isTrue() ) )

Share on other sites
Yeah that works too, but !isTrue() worked at least in version 2.13.1.
I don't know why there should be extra parenthesis necessary now.

Regards,
Tim

Share on other sites
I am not sure why. It is perhaps some ANSI requirement. BTW you don't specify which tool you are talking about (version 2.13.1 of what?) and the language you are using. Probably C++ ?

Share on other sites
Quote:
 Original post by VinzOBTW you don't specify which tool you are talking about (version 2.13.1 of what?) and the language you are using. Probably C++ ?

Give that this is the AngelCode forum, you can assume the language is AngelScript.

Share on other sites
Sure, sorry. I got here by clicking on
"recent threads" on the homepage. Haven't seen the forum title.

Share on other sites
This must be a bug that made it into the latest release. I'll have fixed a.s.a.p.

Thanks for letting me know.

Regards,
Andreas

Share on other sites
This bug was caused by the introduction of the !is operator. The tokenizer is incorrectly parsing the "!" "isTrue" tokens as "!is" "True", which causes the error you're seeing.

I'll have a fix for it soon.

1. 1
Rutin
37
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• Forum Statistics

• Total Topics
633346
• Total Posts
3011450
• Who's Online (See full list)

There are no registered users currently online

×