Home AMX User Forum NetLinx Studio

How many OR's can I use?

Can I do

this || this || this ?

I have a block of code that is working except that it seems to be ignoring that third conditional.
Disregard syntax, I think you get what Im saying =)

Comments

  • mpullinmpullin Posts: 949
    I don't think this is allowed in NetLinx. Use parentheses, e.g. this || (that || the_other)
    You could also add them in most cases but it's obviously less efficient.
  • Thank you Thank you Thank you

    (There forum gave me an error that one "Thank you" was not sufficient. (Minimum of 10 characters).
  • Well, it does work how I originally had it. But only AFTER I tried it how you suggested.
    So, to be clear, didnt work how I originally had it, tried it your way and it worked, changed it back how I originally had it and it worked.

    Ugghhh...Im experiencing the weirdest things with Netlinx. Its like it needs to be kicked one time in the right place and then it will work forever after. Weird. The other instance of this weirdness I had was using a constant in a function (function resides in an Include) that I called from a module. The constant was defined in the Include. Well it wouldnt work until I used the actual value instead of my constant. Then I could go back and use the constant and it would work every time. I had to do this in every instance where I called that function. What a pain...
  • the8thstthe8thst Posts: 470
    Well, it does work how I originally had it. But only AFTER I tried it how you suggested.
    So, to be clear, didnt work how I originally had it, tried it your way and it worked, changed it back how I originally had it and it worked.

    Ugghhh...Im experiencing the weirdest things with Netlinx. Its like it needs to be kicked one time in the right place and then it will work forever after. Weird. The other instance of this weirdness I had was using a constant in a function (function resides in an Include) that I called from a module. The constant was defined in the Include. Well it wouldnt work until I used the actual value instead of my constant. Then I could go back and use the constant and it would work every time. I had to do this in every instance where I called that function. What a pain...

    Modules are in a closed sandbox, so the include constants were outside of the module's scope.
  • a_riot42a_riot42 Posts: 1,624
    Can I do

    this || this || this ?

    I have a block of code that is working except that it seems to be ignoring that third conditional.
    Disregard syntax, I think you get what Im saying =)

    Yes I do this all the time without issue. You do have to be careful about combining operators but in Netlinx || is already the lowest precedence I believe.
    Paul
  • DHawthorneDHawthorne Posts: 4,584
    I never did bother to memorize all the NetLinx precedence rules, because I've found that forcing it via parentheses makes it both unnecessarily to rely on precedence and easier to read later on. So I wind up using parentheses a lot more than is absolutely necessary.
Sign In or Register to comment.