Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: More flexible SELECT TYPE #7

Open
jacobwilliams opened this issue Jul 6, 2017 · 1 comment
Open

Proposal: More flexible SELECT TYPE #7

jacobwilliams opened this issue Jul 6, 2017 · 1 comment

Comments

@jacobwilliams
Copy link
Member

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
@zbeekman
Copy link
Member

God yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants