| 1 |
! Check whether nested WHEREs work |
| 2 |
program where_16 |
| 3 |
integer :: a(9) |
| 4 |
integer :: b(9) |
| 5 |
integer :: c(9) |
| 6 |
|
| 7 |
a = (/0, 0, 0, 1, 1, 1, 2, 2, 2/) |
| 8 |
b = (/0, 1, 2, 0, 1, 2, 0, 1, 2/) |
| 9 |
c = (/0, 0, 0, 0, 0, 0, 0, 0, 0/) |
| 10 |
|
| 11 |
where (a .eq. 0) |
| 12 |
where (b .eq. 0) |
| 13 |
c = 1 |
| 14 |
else where (b .eq. 1) |
| 15 |
c = 2 |
| 16 |
else where |
| 17 |
c = 3 |
| 18 |
endwhere |
| 19 |
elsewhere (a .eq. 1) |
| 20 |
where (b .eq. 0) |
| 21 |
c = 4 |
| 22 |
else where (b .eq. 1) |
| 23 |
c = 5 |
| 24 |
else where |
| 25 |
c = 6 |
| 26 |
endwhere |
| 27 |
elsewhere |
| 28 |
where (b .eq. 0) |
| 29 |
c = 7 |
| 30 |
else where (b .eq. 1) |
| 31 |
c = 8 |
| 32 |
else where |
| 33 |
c = 9 |
| 34 |
endwhere |
| 35 |
endwhere |
| 36 |
if (any (c .ne. (/1, 2, 3, 4, 5, 6, 7, 8, 9/))) & |
| 37 |
STOP 1 |
| 38 |
end program |
| 39 |
|