<div dir="ltr">I&#39;m writing some code something like this:<br><br>class MyMidiThing<br>{<br>    // static int stores midi channels to use<br>    0 =&gt; static int nextChannel;<br><br>    // instance variable stores midi channel for object<br>    int channel;<br><br>    fun init()<br>    {<br>        if (nextChannel &gt; 15) {<br>            // NO MORE MIDI CHANNELS!<br>            // PANIC! EXPLODE! ... how?<br>        }<br>        nextChannel =&gt; channel;<br>        nextChannel++;<br>        // ... go on to do stuff ...<br>    }<br>    // ...<br><div>}</div><div><br></div><div>Clearly I want to do something when there are no more MIDI channels available that stops the program and prints error info, like a stack trace.<br><br></div><div>In general programming terminology, to throw an exception.</div><div><br></div><div>I&#39;ve been scanning the documentation, and maybe I&#39;m dense, but I can&#39;t find out how to do what I want here.</div><div><br></div><div>Suggestions?</div><div><br></div><div>Forrest</div><div><br></div></div>