# Loop Iteration Examples

 ```#include struct S { int i, j; }; void ?{}( S & s ) { s.[i, j] = 0; } void ?{}( S & s, int i ) { s.[i, j] = [i, 0]; } void ?{}( S & s, int i, int j ) { s.[i, j] = [i, j]; } void ?{}( S & s, zero_t ) { s.[i, j] = 0; } void ?{}( S & s, one_t ) { s.[i, j] = 1; } int ??( S t1, S t2 ) { return t1.i > t2.i && t1.j > t2.j; } int ?>=?( S t1, S t2 ) { return t1.i >= t2.i && t1.j >= t2.j; } S ?=?( S & t1, S t2 ) { t1.i = t2.i; t1.j = t2.j; return t1; } S ?+=?( S & t1, S t2 ) { t1.i += t2.i; t1.j += t2.j; return t1; } S ?+=?( S & t, one_t ) { t.i += 1; t.j += 1; return t; } S ?-=?( S & t1, S t2 ) { t1.i -= t2.i; t1.j -= t2.j; return t1; } S ?-=?( S & t, one_t ) { t.i -= 1; t.j -= 1; return t; } ofstream & ?|?( ofstream & os, S v ) { return os | '(' | v.i | v.j | ')'; } int main() { sout | nlOff; // turn off auto newline for ( i; 1 ~ @ ) { if ( i > 10 ) break; sout | i; } sout | nl | nl | nl | nl; for ( i; 10 -~ @ ) { if ( i < 0 ) break; sout | i; } sout | nl | nl | nl | nl; for ( i; 2 ~ @ ~ 2 ) { if ( i > 10 ) break; sout | i; } sout | nl | nl | nl | nl | nl; for ( i; 2.1 ~ @ ~ @ ) { if ( i > 10.5 ) break; sout | i; i += 1.7; } sout | nl | nl | nl | nl; for ( i; 10 -~ @ ~ 2 ) { if ( i < 0 ) break; sout | i; } sout | nl | nl | nl | nl | nl; for ( i; 12.1 ~ @ ~ @ ) { if ( i < 2.5 ) break; sout | i; i -= 1.7; } sout | nl | nl; for ( i; 10 : j; -5 ~ @ ) { sout | i | j; } sout | nl; for ( i; 10 : j; -5 -~ @ ) { sout | i | j; } sout | nl; for ( i; 10 : j; -5 ~ @ ~ 2 ) { sout | i | j; } sout | nl; for ( i; 10 : j; -5 -~ @ ~ 2 ) { sout | i | j; } sout | nl | nl; for ( j; -5 ~ @ : i; 10 ) { sout | i | j; } sout | nl; for ( j; -5 -~ @ : i; 10 ) { sout | i | j; } sout | nl; for ( j; -5 ~ @ ~ 2 : i; 10 ) { sout | i | j; } sout | nl; for ( j; -5 -~ @ ~ 2 : i; 10 ) { sout | i | j; } sout | nl | nl; for ( j; -5 -~ @ ~ 2 : i; 10 : k; 1.5 ~ @ ) { sout | i | j | k; } sout | nl; for ( j; -5 -~ @ ~ 2 : k; 1.5 ~ @ : i; 10 ) { sout | i | j | k; } sout | nl; for ( k; 1.5 ~ @ : j; -5 -~ @ ~ 2 : i; 10 ) { sout | i | j | k; } sout | nl | nl | nl; for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } sout | nl; for ( s; (S){10,10} ) { sout | s; } sout | nl; sout | nl; for ( s; (S){0} ~ (S){10,10} ) { sout | s; } sout | nl; for ( s; (S){0} ~ (S){10,10} ~ (S){1} ) { sout | s; } sout | nl; for ( s; (S){0} ~= (S){10,10} ) { sout | s; } sout | nl; for ( s; (S){0} ~= (S){10,10} ~ (S){1} ) { sout | s; } sout | nl; sout | nl; for ( s; (S){10,10} -~ (S){0} ) { sout | s; } sout | nl; for ( s; (S){10,10} -~ (S){0} ~ (S){1} ) { sout | s; } sout | nl; for ( s; (S){10,10} -~= (S){0} ) { sout | s; } sout | nl; for ( s; (S){10,10} -~= (S){0} ~ (S){1} ) { sout | s; } sout | nl; } ``` ``` 1 2 3 4 5 6 7 8 9 10 10 9 8 7 6 5 4 3 2 1 0 2 4 6 8 10 2.1 3.8 5.5 7.2 8.9 10 8 6 4 2 0 12.1 10.4 8.7 7 5.3 3.6 0 -5 1 -4 2 -3 3 -2 4 -1 5 0 6 1 7 2 8 3 9 4 0 -5 1 -6 2 -7 3 -8 4 -9 5 -10 6 -11 7 -12 8 -13 9 -14 0 -5 1 -3 2 -1 3 1 4 3 5 5 6 7 7 9 8 11 9 13 0 -5 1 -7 2 -9 3 -11 4 -13 5 -15 6 -17 7 -19 8 -21 9 -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