 <p>It sounds like what you want is a <a href="http://en.wikipedia.org/wiki/Finite-state_machine" rel="nofollow noreferrer">'Finite State Machine'</a> where using those cases you can activate different processes or 'states'. In C this is usually done with an array (matrix) of function pointers.</p> <p>So you essentially make an array and put the right function pointers at the right indicies and then you use your 'var' as an index to the right 'process' and then you call it. You can do this in most languages. That way different inputs to the machine activate different processes and bring it to different states. This is very useful for numerous applications; I myself use it all of the time in MCU development.</p> <p>Edit: Valya pointed out that I probably should show a basic model:</p> <pre><code>stateMachine[var1][var2](); // calls the right 'process' for input var1, var2 </code></pre>