comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: FOR loop ends one above where it's supposed to
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: FOR loop ends one above where it's supposed to [message #71120] Wed, 02 June 2010 09:49 Go to previous message
Bulgakovv is currently offline  Bulgakovv
Messages: 2
Registered: June 2010
Junior Member
On Jun 2, 12:07 pm, pp <pp.pente...@gmail.com> wrote:
> On Jun 2, 12:57 pm, Paolo <pgri...@gmail.com> wrote:
>
>> While people here gave a logical explanation as to what is happening,
>> I would say that the *safest* practice in your programming is to not
>> use the for loop index variable ("i" in this case) for anything else
>> in your program. That will make the code much easier to write, read
>> and understand.
>
> Which is why I miss block scope in IDL, so that the variable would not
> even exist outside the loop.

Thanks for your comments! In Matlab for example, the loop index
variable stays on the last number, in this case 5, I guess that's how
I confused it in first place as I'm used to Matlab. I used the loop
index variable for testing in my program, not to be in there, that's
how I came across the whole situation. But, I guess I will have to
follow your advice Paolo..
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL for planetary photometry
Next Topic: Re: dealing with arguments

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:33:10 PDT 2025

Total time taken to generate the page: 0.00449 seconds