Re: While Statement issue with Uno2 #UnO2


ok, I tried it out myself now and I can confirm these are 2 bugs : 
- arithmetic functions on variables should always keep the value between 0 and 127, also in case of "overflow"
- when using a "while" loop within a switch statement, the "case" condition is not correctly evaluated on statements following the while loop. 

Following version works correctly, because it doesn't have statements after the "while" :
(for your info : the "default:" statement within a switch statement is optional, so if it doesn't contain any commands you can omit it) 

TRIGGER_CLICK AllNotesOffPanic =
      case "Hammond":
         SendMidi Hammond CtrlChange $HammondAllSoundsOff 127
      case "Nord":
         SendMidi Nord NoteOff 127 0
         while ($currentnote > 0)
            SendMidi Nord NoteOff $currentnote 0
         // don't add any more commands here...

Join to automatically receive all group messages.