Charlie Crown
Charlie Crown

Reputation: 1089

Using all variables in a module, except for one - is there an opposite of "only"?

I have a module with global variables, there are a lot of variables in it. For a specific subroutine I would like to use all variables in it except for 1.

One way I could do this is

use Global_Variables, only : item1,...item50,item52,...item100

but that is incredibly painful to write out 99 items to use, just so in this example I can skip item51.

I could also put this specific item in a seperate Global_Variables2 module, but that is unwieldy.

Is there an except clause that can be used similarly but oppositely of the only clause?

Upvotes: 5

Views: 1067

Answers (1)

You can rename the variable to something that obviously should not be used

 use mod, disabled => item

There is no except in Fortran 2008. Also think if that variable really needs to be public.

Upvotes: 5

Related Questions