| 1 | // name: AlgorithmFor6
|
|---|
| 2 | // keywords: algorithm,array
|
|---|
| 3 | // status: correct
|
|---|
| 4 | //
|
|---|
| 5 | // Test for multiple loops in algorithms.
|
|---|
| 6 | //
|
|---|
| 7 |
|
|---|
| 8 | class AlgorithmFor6
|
|---|
| 9 | Real a[2,3];
|
|---|
| 10 | algorithm
|
|---|
| 11 | for i, j in {2,3} loop
|
|---|
| 12 | a[i,j] := i + j;
|
|---|
| 13 | end for;
|
|---|
| 14 | end AlgorithmFor6;
|
|---|
| 15 |
|
|---|
| 16 | // Result:
|
|---|
| 17 | // class AlgorithmFor6
|
|---|
| 18 | // Real a[1,1];
|
|---|
| 19 | // Real a[1,2];
|
|---|
| 20 | // Real a[1,3];
|
|---|
| 21 | // Real a[2,1];
|
|---|
| 22 | // Real a[2,2];
|
|---|
| 23 | // Real a[2,3];
|
|---|
| 24 | // algorithm
|
|---|
| 25 | // for i in 1:2 loop
|
|---|
| 26 | // for j in {2,3} loop
|
|---|
| 27 | // a[i,j] := Real(i + j);
|
|---|
| 28 | // end for;
|
|---|
| 29 | // end for;
|
|---|
| 30 | // end AlgorithmFor6;
|
|---|
| 31 | // endResult
|
|---|