I have some code where I want to do a for loop, iterating over a fixed set of integers. Unfortunately, the set isn't in any incrementalable order - e.g., it's something like
These numbers are known at the time I'm writing the code.Code:{ 10, 14, 23, 25 }
I can think of various ways of simulating a "foreach loop" (like perl, etc. have) - put them in an array and do a for loop by index, a linked list, etc.
I'm just wondering if there is some clever construct that I'm overlooking to do a for() loop that isn't limited to number sets that are neatly incremental.