How do I use != in an expression?

0 favourites
  • 10 posts
From the Asset Store
Add this awesome sound effects to make your visual novel come to life!
  • Hello, I am going over the System expressions, and I cant seem to find an operator for not-equals. I am trying to pick by evaluate all backgrounds that do not have the instance variable "Static" so my expression would look something like this:

    GUIbackground.Type!="Static"

    Looking in the manual I see a bunch of great operators, but i cant seem to get a workaround for not equals. I tried to invert the Pick by evaluate condition block but C2 does not seem to feature this option for this type of condition.

    Sorry, I am used to binary operators in C#.

    Anyone have workarounds for this?, TIA for any help.

  • There totally is an options named <<≠ not equal to>> when you pick the <<Compare instance variable>> event.

  • Use <> instead of !=

    So, GUIbackground.Type<>"Static"

  • Use <> instead of !=

    So, GUIbackground.Type<>"Static"

    Brilliant! This will save me lots of time. This saves me from making 12 other conditions.

    Thanks so much

  • "<>" is even in the manual, you must have overlooked it ^^.

  • "<>" is even in the manual, you must have overlooked it ^^.

    Relational and equality operators

    Less than (<)

    Greater than (>)

    Less than or equal to (<=)

    Greater than or equal to (>=)

    Equal to (==)

    Not equal to (!=)

    Yeah, I have never seen <> before.... The above are all I know from C#.

    Is "<>" a java script thing?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's used in BASIC, SQL and probably others.

    != is more common and is used in c, Python and JavaScript off the top of my head.

    Some languages even use something different like ~= in Lua.

  • Ok, I was wrong, was under the impression that https://www.scirra.com/tutorials/77/nat ... onstruct-2 was a manual entry. My bad.

    It's nothing new that those operators are not the same across all programming and scripting languages, though.

  • There's a manual page that deals with operators, although it's a section in the Expressions entry.

  • There's a manual page that deals with operators, although it's a section in the Expressions entry.

    Yeah,

    [quote:exeqcdyl]There are also comparison operators =, <>, <, <=, >, >= for comparing values. They return 1 if the comparison is true or 0 if false.

    Dose not say what it is really... I assumed it meant everything except for the value I was testing.

    It's used in BASIC, SQL and probably others.

    != is more common and is used in c, Python and JavaScript off the top of my head.

    Some languages even use something different like ~= in Lua.

    Thank you this is very useful. I only have dealt with Python and C#. i would like to take a Java script class someday.

    Ok, I was wrong

    Apology accepted.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)