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

Home » Public Forums » archive » Re: nested subroutines and scope
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: nested subroutines and scope [message #28979] Fri, 25 January 2002 10:40 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
If variables need to be global within a procedure only, what's wrong
with passing them as parameters to another procedure called from the
parent one?
Pavel

Chris O'Dell wrote:
>
> This is a two-part question from an IDL newbie.
>
> 1) Is it possible to nest procedures or functions in IDL?
> 2) If the answer to (1) is yes, is there anyway to give certain
> variables global scope within the primary procedure/function,
> so they can be "seen" by all the nested procedures/functions
> within the main function?
>
> I used to do this all the time in pascal. Some pseudo-code might be
> as follows:
>
> function mainfunc, x, a1
>
> function subfunc, y
> return, a1 * y^2
> end ; subfunc
>
> return, subfunc(x) * subfunc(x^2)
>
> end ; mainfunc
>
> If you think this is terrible programming practice (which it probably
> is), can anyone suggest a better way, without having to pass
> all the global variables as parameters?
>
> Thanks,
> Chris O'Dell
[Message index]
 
Read Message
Read Message
Previous Topic: Re: 3d matrices and LUSOL
Next Topic: Re: Convert a byte array to a structure?

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

Current Time: Fri Oct 10 07:24:39 PDT 2025

Total time taken to generate the page: 1.92253 seconds