Use for loop with if and else
<p>I have a situation where I have to do some thing like this</p>

<pre><code>for (int i = 0; i &lt; list.size; i++) //Master for loop
{ 
    //I need a control statement here to control list1 i.e. only if statement

    if (time == list1.get(someInteger))
    {
        //do something
    }
    else
    {
        //do something else
    }
}
</code></pre>

<p>But every "if" should be followed by an "else", and I don't seem to understand how to go about it. Ive tried do and while but to no avail. For me it is important to execute both if and else, yet have a control statement for only "if". </p>

<p>Is that possible?</p>
