Learn first
Programs follow precise instructions
A program is a set of instructions. A variable stores a value. A condition chooses between paths. A loop repeats steps. Output is the result produced.
How to work it out Trace one instruction at a time. Keep a record of values and check exactly when a condition or repeated step is evaluated.
A separate example In a separate trace, start with n = 2, add 3, then double n. The two instructions happen in order: 5 is an intermediate value before the final result.
Keep the supplied order. Start result at 0. Test each value against value >= 2. At the first match, copy the value and stop this scan. Continue with the report after the loop. If nothing matches, keep fallback 0; it is not a found item. Item numbers on this page begin at 1.
Worked example
For [0, 4, 3], inspect 0 (false), then 4 (true). Copy 4 at item 2 and stop. Two comparisons ran. The later 3 was not inspected.
The next delivery list
Use [1, 0, 3, 4] in that exact order. The rule is value >= 2, the starting result is 0, and the report comes after the loop. Do not sort, add all matches, or keep searching after copying the first match.