HISE Logo Forum
    • Categories
    • Register
    • Login

    Switch statement breaks if value changes after on init

    Scheduled Pinned Locked Moved Solved Bug Reports
    5 Posts 3 Posters 203 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.
    • d.healeyD
      d.healey
      last edited by d.healey

      Run the snippet and hit the button. The Console will print "ZERO OR EQUAL" because the two knobs have the same value. Now change the value of both knobs to 4 and press the button again. Even though both knobs have the same value it will now print "DEFAULT".

      This is either a bug or a failure to tell me I'm doing something I shouldn't be (I'm pretty sure the cases have to be constants...)

      HiseSnippet 1023.3ocyV01aaaCDlxIJsxaqXcn+.DB1GrAJBr8Z6FVwvbheovnwIdwIAa6CsfVhJlvTjBjTowaH.6mx9I1+AsGojijqMxKFX.S.1fGu643ych2cZjTDPTJgD43c57DBx4qcGOmqm1YJlxQC5hbdh6PrRSj9Yacv7DrRQBQNNa8FyFNdairOe7WO.yv7.RwVHz4BZ.4PZLUWr6n1ukxX8wgjSowkr9EsGDH3cDLQJvmsbafRvAyvWPNBaLqhKxYmdgTsPNVi0DEXyAhv4imJ9.Oy9yoJ5DFwHzDMFbT11nNSorvQKhUEB4r8nhHeqrH+YtCogza1uHC7sVE9EHJmCbpbaTp4CfRNknz1YT5otiCjzDcgFCe9J2Ab3ERDFR0koRlsnJ5JtcDfEb8dw3Yj9RP3FD0dUiFO2G9q9qqVER2Js+kXo+a4hIM8+E+E.ufn6HhSDbPn1tVs6BHVFPqaEPKCfpTNixI9Qo7.MUv8gjjtV8p+cUO0Gn5fo90rN2f+bLKkTqd8pdfVu.rh323mWrx5wRVYT3AGtRvH6kHolS8O6cxw9Geheue6r8Ozb5fISjD7L6J3WHIBmxzqCa2d82+rCO0h55pWWcUlK3Gjp0BdSSHKErZAKh2mCYDfT1nhF4WKWxyKKXec0qgDw5ST4tb256oL6acbGLiMAt4W6KOQvSkXyQBM4XdVtDHr+WpJJZs5x8EiHWqZSIo71.VimFOgHKGyFCg6rKWHry8qPHHKsTxPAe.mpONgjK2WvBMWvMqWsrAkmWgBnJ4LDLUaKedRd4yXFMjHQTvIOx0dcCYIeQqmG2FcuA2ZMfOaPWrFaJhyoCPwDhTSMYBmtjKgtfYkzdtcIpYZQBbP2bO.Z6dmL9Jjiqyb33laV7NXgRO2jO2wZ.JlFFxHiDJp48UA6dVan6cxX5eAl551buFfk7xsniwWUH98sUoQQzqrsainrXkF3yfXnKLx46bOCpDyKh7Uy.+.kHyHgmJr1id.ATKToS8csmeiv+D09+0A1iVNvxpPsAlmad4ZoP6e0kBMzezlpFJhA+fkv1NUHbLTSXFubHAK4lt3J7kjA7QRBzPvHiVcr.LPRDlxv5kmRYFGmqvjnJOZvz9mCIv4kGW+.Fc03VGcceo3ScGYZ4udNVYMbzTT+e.GyG3+Mt8hhHA5BBtsa+eeSmteGG+IhTMkewPLbsyTJeTZ7X36bBHvoy4DlxTUWwzOKStgQ1jAFS3gVgOAO4JaZjcxU1bgR3BefT79frFYlOo3w1c.NwseAkG7obfr+Js+PlhL56CBV1Uq.r0lB7G1TfuXSA9xME3q1Tf+3lB7mtaflND6mpEwYkMHzvQ8rSbbb5YagXush9rdMlCw
      

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

      1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff
        last edited by

        "In a switch statement, the cases are evaluated at compile time, meaning they need to be constants or literals known at compile time."

        Dan Korneff - Producer / Mixer / Audio Nerd

        Christoph HartC 1 Reply Last reply Reply Quote 1
        • Christoph HartC
          Christoph Hart @Dan Korneff
          last edited by

          found this gem here:

          https://forum.juce.com/t/does-juce-javascript-not-support-the-switch-statement/14394/3

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

            @Christoph-Hart

            Aha that explains it. And no one replied to your wonderful post, how rude!

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

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • d.healeyD d.healey marked this topic as a question on
            • d.healeyD d.healey has marked this topic as solved on
            • Christoph HartC
              Christoph Hart @d.healey
              last edited by

              @d-healey I got one like so it‘s not nothing…

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

              46

              Online

              1.7k

              Users

              11.7k

              Topics

              101.8k

              Posts