Re: Array Constructors



Yes. I'm following up to myself. I forgot one addition that I consider
important.

Richard Maine <nospam@xxxxxxxxxxxxx> wrote:

By the way. Don't do that.

I was saying that about a particularly obscure "feature" that I
illustrated. but it applies to the OP's posting as well. People have
explained what is going on (that there are 2 separate variables), but I
don't think anyone mentioned this suggestion:

Having the two variables of the same name causes confusion. The
confusion is well illustrated by the OP's thinking that this was one
variable whose value somehow got reset. I can se how that might be a
conclusion that someone could draw from observing behavior.

I recommend never using the same name as another variable for an implied
DO index variable in an array constructor or DATA statement. I
personally name my array constructor implied DO index variables things
like i_do in order to clearly separate them from just plain i, which is
likely to get used elsewhere.

Also note that I/O-implied DO variables are different. They do not have
their own scope, but are "ordinary" variables. There was once a time
when I was unaware of this distinction myself (and thus made a fool of
myself vehemently explaining something that turned out to be wrong. Oh
well. It happens).

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.


Quantcast