Manual Reference Pages  - get_type (3m_anything)

NAME

get_type(3f) - [M_anything] return array of strings containing type names of arguments (LICENSE:MIT)

CONTENTS

Synopsis
Description
Options
Return
Example
Author
License

SYNOPSIS

function get_type(anything) result(chars)

    class(*),intent(in)  :: anything
            or
    class(*),intent(in)  :: anything(..)

character(len=:),allocatable :: chars

DESCRIPTION

This function uses polymorphism to allow input arguments of different types. It is used by other procedures that can take many argument types as input options.

OPTIONS

VALUEIN
  input array or scalar to return type of May be of KIND INTEGER(kind=int8), INTEGER(kind=int16), INTEGER(kind=int32), INTEGER(kind=int64), REAL(kind=real32, REAL(kind=real64), REAL(kind=real128), complex, or CHARACTER(len=*)

RETURN

CHARS The returned value is an array of names

EXAMPLE

Sample program

   program demo_get_type
   use M_anything,      only : get_type
   implicit none
   integer :: i
      write(*,*)get_type([(i*i,i=1,10)])
      write(*,*)get_type([11.11,22.22,33.33])
      write(*,*)get_type(’This is a string’)
      write(*,*)get_type(30.0d0)
   end program demo_get_type

Results:

    int32
    real32
    character
    real64

AUTHOR

John S. Urban

LICENSE

    MIT


Nemo Release 3.1 get_type (3m_anything) April 04, 2023
Generated by manServer 1.08 from 4c4d1152-3c52-4a87-a735-0ac1dc137fdf using man macros.