How can I find the index of the nth element in an array to match a condition?
<p>I have an array with four boolean values. I want to find the index of the nth true one. For example, if they were <code>false, true, true, true</code> and n was 2, it would return 3. Is there any way that I can do that easily? All my attempts turn into a mess quickly.</p>
