File: example_optval.f90

package info (click to toggle)
fortran-stdlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,008 kB
  • sloc: f90: 24,178; ansic: 1,244; cpp: 623; python: 119; makefile: 13
file content (14 lines) | stat: -rw-r--r-- 313 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
program example_optval
  use stdlib_optval, only: optval
  implicit none
  print *, root(64.0)
! 8.0
  print *, root(64.0, 3)
! 4.0
contains
  real function root(x, n)
    real, intent(in) :: x
    integer, intent(in), optional :: n
    root = x**(1.0/optval(n, 2))
  end function root
end program example_optval