A convenience thing; it would be nice to write:
Instead of:
Output:
1 x 1 = 1
1 x 2 = 2
1 x 3 = 3
:
:
12 x 11 = 132
12 x 12 = 144
(144 lines)
C#:
// 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:
C#:
foreach (int m in factors)
foreach (int n in factors)
Debug.Log(string.Format("{0} x {1} = {2}", m, n, m * n));
Output:
1 x 1 = 1
1 x 2 = 2
1 x 3 = 3
:
:
12 x 11 = 132
12 x 12 = 144
(144 lines)