File: declaration_01.f90

package info (click to toggle)
lfortran 0.61.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 61,892 kB
  • sloc: cpp: 181,767; f90: 92,175; python: 17,616; ansic: 10,170; yacc: 2,377; sh: 1,444; fortran: 892; makefile: 38; javascript: 15
file content (27 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (3)
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
27
program declaration_01
    implicit none
    integer, parameter :: xi = 2
    real, parameter :: xr = 2.0
    ! real array initialized with integer constant value
    real, parameter :: x_real_3(3) = xi

    ! complex array initialized with integer constant value
    complex, parameter :: x_cmplx_3(3) = xi

    ! integer array initialized with real constant value
    integer, parameter :: x_int_3(3) = xr
    real :: y(2) = real([2, 3])

    print *, x_real_3
    if (any(x_real_3 /= xi)) error stop

    print *, x_cmplx_3
    if (any(x_cmplx_3 /= (xi, 0))) error stop

    print *, x_int_3
    if (any(x_int_3 /= xr)) error stop

    print *, y
    if (abs(y(1) - 2.0) > 1e-7) error stop
    if (abs(y(2) - 3.0) > 1e-7) error stop
end program declaration_01