Arange
Returns a vector of integers (or reals) by specifying istart
, iend
, and increment
values.
Calling example:
avec = arange(istart, iend, increment)
- Default value of increment is 1.
Interface
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION arange(istart, iend, increment) RESULT(Ans)
INTEGER(Int8| Int16 | Int32 | Int64) | REAL(Real32| Real64), INTENT(IN) :: istart
!! Start value of the array
INTEGER(Int8| Int16 | Int32 | Int64) | REAL(Real32| Real64), INTENT(IN) :: iend
!! End value of the array
INTEGER(Int8| Int16 | Int32 | Int64) | REAL(Real32| Real64), INTENT(IN), OPTIONAL :: increment
!! Array increment
INTEGER(Int8| Int16 | Int32 | Int64) | REAL(Real32| Real64), DIMENSION(:), ALLOCATABLE :: Ans
END FUNCTION arange
END INTERFACE
program main
use easifemBase
implicit none
CALL Display(arange(1.0, 10.0, 1.0), "ans = ", full=.true., orient="row" )
See results
results
ans =
----------------------------------------------------------------------------------------
1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 10.0000
CALL Display(arange(1, 10, 2), "ans = ", full=.true., orient="row" )
See results
results
ans =
-------------
1 3 5 7 9
end program main