HISE Logo Forum
    • Categories
    • Register
    • Login

    Just wondering about how this logic condition evaluates

    Scheduled Pinned Locked Moved Scripting
    6 Posts 3 Posters 75 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • VirtualVirginV
      VirtualVirgin
      last edited by VirtualVirgin

      I was expecting this statement to return "false" as soon as it detects that the "selected" variable is not an array. Instead it moves on to checking if the non-existent array contains a value.
      Shouldn't it just return "false" instead of throwing an error?
      Screenshot 2025-06-18 at 8.39.30 PM.png

      You can listen to my orchestral mockups here:
      https://www.virtualvirgin.net/

      d.healeyD LindonL 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @VirtualVirgin
        last edited by

        @VirtualVirgin you need a set of parentheses around the two parts that belong to the && I think

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        VirtualVirginV 1 Reply Last reply Reply Quote 1
        • LindonL
          Lindon @VirtualVirgin
          last edited by

          @VirtualVirgin said in Just wondering about how this logic condition evaluates:

          I was expecting this statement to return "false" as soon as it detects that the "selected" variable is not an array. Instead it moves on to checking if the non-existent array contains a value.
          Shouldn't it just return "false" instead of throwing an error?
          Screenshot 2025-06-18 at 8.39.30 PM.png

          this is pretty poorly self-documenting code, separate it out into a set of if statements

          HISE Development for hire.
          www.channelrobot.com

          1 Reply Last reply Reply Quote 0
          • VirtualVirginV
            VirtualVirgin @d.healey
            last edited by

            @d-healey said in Just wondering about how this logic condition evaluates:

            @VirtualVirgin you need a set of parentheses around the two parts that belong to the && I think

            Yes! That is the solution :)

            You can listen to my orchestral mockups here:
            https://www.virtualvirgin.net/

            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @VirtualVirgin
              last edited by

              @VirtualVirgin said in Just wondering about how this logic condition evaluates:

              Yes! That is the solution :)

              You can probably also get rid of the ternary operator at the end - ? true : false because the statement itself should return true or false.

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              VirtualVirginV 1 Reply Last reply Reply Quote 0
              • VirtualVirginV
                VirtualVirgin @d.healey
                last edited by

                @d-healey said in Just wondering about how this logic condition evaluates:

                @VirtualVirgin said in Just wondering about how this logic condition evaluates:

                Yes! That is the solution :)

                You can probably also get rid of the ternary operator at the end - ? true : false because the statement itself should return true or false.

                Yes, that makes sense. It is just evaluating to that anyway, so no need to make it redundant.

                You can listen to my orchestral mockups here:
                https://www.virtualvirgin.net/

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post

                34

                Online

                1.8k

                Users

                12.0k

                Topics

                104.1k

                Posts