File: where_12.f90

package info (click to toggle)
lfortran 0.60.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,416 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 38; javascript: 15
file content (21 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
program where_12
    integer ::arr(3,3,3)
    integer ::arr2(3,3,3)

    arr = 10
    arr2 = 11
    
    arr(:,2,:) = 0
    where(arr == 0)
        arr = 555
        arr2 = 555
    end where
    
    print *, arr
    if(any(arr(:,2,:) /= 555) .or. any(arr(:,1,:) /= 10) .or. any(arr(:,3,:) /= 10)) error stop

    ! Test whether the other array got affected or not, just to make sure assignments inside if are handled correctly by where pass.
    print *, arr2
    if(any(arr2(:,2,:) /= 555) .or. any(arr2(:,1,:) /= 11) .or. any(arr2(:,3,:) /= 11)) error stop
    
end program where_12