| 1 |
! Program to test the ANY and ALL intrinsics |
| 2 |
program anyall |
| 3 |
implicit none |
| 4 |
logical, dimension(3, 3) :: a |
| 5 |
logical, dimension(3) :: b |
| 6 |
character(len=10) line |
| 7 |
|
| 8 |
a = .false. |
| 9 |
if (any(a)) STOP 1 |
| 10 |
a(1, 1) = .true. |
| 11 |
a(2, 3) = .true. |
| 12 |
if (.not. any(a)) STOP 2 |
| 13 |
b = any(a, 1) |
| 14 |
if (.not. b(1)) STOP 3 |
| 15 |
if (b(2)) STOP 4 |
| 16 |
if (.not. b(3)) STOP 5 |
| 17 |
b = .false. |
| 18 |
write (line, 9000) any(a,1) |
| 19 |
read (line, 9000) b |
| 20 |
if (.not. b(1)) STOP 6 |
| 21 |
if (b(2)) STOP 7 |
| 22 |
if (.not. b(3)) STOP 8 |
| 23 |
|
| 24 |
a = .true. |
| 25 |
if (.not. all(a)) STOP 9 |
| 26 |
a(1, 1) = .false. |
| 27 |
a(2, 3) = .false. |
| 28 |
if (all(a)) STOP 10 |
| 29 |
b = all(a, 1) |
| 30 |
if (b(1)) STOP 11 |
| 31 |
if (.not. b(2)) STOP 12 |
| 32 |
if (b(3)) STOP 13 |
| 33 |
b = .false. |
| 34 |
write (line, 9000) all(a,1) |
| 35 |
read (line, 9000) b |
| 36 |
if (b(1)) STOP 14 |
| 37 |
if (.not. b(2)) STOP 15 |
| 38 |
if (b(3)) STOP 16 |
| 39 |
|
| 40 |
9000 format (9L1) |
| 41 |
end program |