A convenience thing; it would be nice to write:
// Assume factors = int[] {1..12}
foreach (int m in factors, int n in factors) // iterate over multiple collections
Debug.Log(string.Format("{0} x {1} = {2}", m, n, m * n));
Instead of:
foreach (int m in factors)
foreach (int n in factors)...
It would be nice to (optionally) have access to ordinal numbers in foreach loops.
For example, printing an enumerated list of names:
foreach (string name in names ord as n)
Debug.Log(string.Format("{0}. {1}", n + 1, name));
The keyword 'ord' starts at 0 and increments by 1 per iteration. It...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.