File: implied_do_loops15.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 (26 lines) | stat: -rw-r--r-- 638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
program implied_do_loops15
integer n(3)
n = [(42, i = 1, size(n))]
print "(3I3)", n
if (any(n /= 42)) error stop

call test_expression()
call test_subroutine()

contains
    subroutine test_expression()
        integer m(5)
        m = [(i*2, i = 1, 5)]
        print "(5I3)", m
        if (m(1) /= 2) error stop
        if (m(5) /= 10) error stop
    end subroutine test_expression

    subroutine test_subroutine()
        integer arr(4)
        arr = [(j*3, j = 1, 4)]
        print "(4I3)", arr
        if (arr(1) /= 3) error stop
        if (arr(4) /= 12) error stop
    end subroutine test_subroutine
end program implied_do_loops15