Skip to content

Proposal: More flexible SELECT TYPE #7

Description

@jacobwilliams

Something so we can avoid these annoying nested select type blocks.

So if you want to check if several variables are integers:

! if several variables are integers
select type (a,b,c)  ! new syntax
class is (integer)
  d = a + b + c
end select

Or if you want to check if a variable is any integer kind:

select type (a)
class is (integer(kind=*))  ! new syntax
  d = a * 2
end select

Or any numeric kind:

select type (a)
class is (integer(kind=*), real(kind=*))  ! new syntax
  d = 1 * 2
end select

And all together:

select type (a,b,c)  ! new syntax
class is (integer(kind=*), real(kind=*))   ! new syntax
  ! a, b, and c are all either integers or reals, 
  ! so compiler knows what to do here:
  d = a + b + c
end select

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions