a more efficient 'if' statement for multiple options
<p>I wonder if anyone has some ideas to make the following shorter and more efficient. I have 3 dropdowns where a user selects lower age limit, upper age limit and gender. They can select as many as they want, even none. I then have an if statement that will do a process based on what they select.  Assume l, u and g are the parameters that are passed.</p>

<pre><code>if((age &gt; l &amp;&amp; age &lt; u &amp;&amp; gender == g)
|| (age &gt; l &amp;&amp; age &lt; u &amp;&amp; g == null)
|| (age &gt; l &amp;&amp; u == null &amp;&amp; g == null)
|| (age &lt; u &amp;&amp; gender == g &amp;&amp; l == null)
|| (age &lt; u ...etc etc)
</code></pre>

<p>Is there a better way of forming this rather then a tedious if statement?</p>