Re: Reference to derived type element by index?



Hi - yes, that's what I want to do. If, as you say, this can't be done then a case statement might be the way to go - it's not as elegant as I'd hoped, but this is just a simple routine to parse a parameter file, so it's not mission-critical. Thanks for your help!

Gary Scott wrote:
Rob Crain wrote:

Hi Gary - thanks for your reply. I think my initial explanation may have been unclear, as this is not the solution to my problem. The problem reduces to the following: I don't know explicitly which variable (I incorrectly referred to this variable as an element previously, hence the confusion) I want to update, so I can't say

circle%radius = <something>

All I have is an index that tells me I need to update the i^th variable within the derived type. So say I need to update circle%z, the index would have value 4. But I know that I can't do

By i'th variable, are you saying the i'th component? No you can't alias an index with the formally defined components and have value 1 refer to radius and value 2 refer to x. You could use select case to make that choice based upon the index. Still not sure I understand fully tho.

<snip>
.



Relevant Pages

  • Re: OT - to the linguists among us
    ... English as a second language would have trouble and confusion with all these ... But then that really isn't correct either since American ... sex to refer to men and women and started using gender? ...
    (rec.crafts.textiles.quilting)
  • Re: OT - Role playing fantasies
    ... course, too, to prevent any further confusion or problems. ... I have always posted under either Andrea or Andrea2. ... there are two computers here & we refer to them as the Desktop and the ... Desktop, and hers, the Laptop, but we each use either computer at times. ...
    (alt.support.diabetes)
  • Re: Whats a Gigabyte?
    ... Some of us prefer to refer to a thousand ... trouble with "billion" is that it can mean either a thousand million or a ... still lead to confusion. ... 'misled on storage capacity' ...
    (uk.comp.homebuilt)
  • Re: OT: On the fate of classical music
    ... myself confused when people refer to Bach as "classical" music. ... and to squelch the confusion that runs rampant through our ... conservatories and guitar studios, I suggest we all adopt the phrase ...
    (rec.music.classical.guitar)
  • Re: Whats a Gigabyte?
    ... Some of us prefer to refer to a thousand ... trouble with "billion" is that it can mean either a thousand million or a ... This may be an attempt to standardize to avoid confusion, ...
    (uk.comp.homebuilt)