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

Home » Public Forums » archive » Re: calling a function in herself
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: calling a function in herself [message #20881] Mon, 31 July 2000 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Martin Schultz (martin.schultz@dkrz.de) writes:

> Here is a really simpl eexample:
> --------------------------------
> function recursive, count
> print,'count = ',count
> if count lt 10 then count = recursive(count+1)
> return, count
> end
>
> ; main
> print,'End result = ',recursive(0L)
> end
>
> -----------------------------------
> save as recursive.pro and start this with .r recursive, and it will run.
> In you rcase,
> you might need to include a FORWARD_FUNCTION statement as the first line
> in h_wahl. That
> shoul dhelp.

What has happened to your keyboard, Martin!?
Better get the ol' WD40 out. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: calling a function in herself [message #20882 is a reply to message #20881] Mon, 31 July 2000 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
"J�rg Schliwa" wrote:
>
> OF course it has to be in the example:
> Function H_Wahl,a,b,Steig=steig,Abstand=abstand
>
> so that was not the error!
>
> J�rg Schliwa <joerg.schliwa@ewetel.net> schrieb in im Newsbeitrag:
> 8m4c9b$3h9$1@ac1.ewetel.de...
>> Hy to all!
>>
>> I have a file with the main-procedure and some functions in it. When I'm
> in
>> the function e.g h_wahl I want to call the function h_wahl again. Is that
>> possible? When I compile the file, the expression h_wahl is not known in
>> h_wahl.
>>
>> e.g.
>> ;procedure rasterung.pro
>>
>> Function H_Wahl(a,b,Steig=steig,Abstand=abstand)
>> If Keyword_Set(abstand) Then .....
>>
>> If Keyword_Set(steig) Then Begin
>> ...
>> return, H_Wahl(c,d,/abstand)
>> Endif
>> End
>>
>> pro rasterung...
>>
>> Any suggestions?
>>
>> Thanks in advance,
>> J�rg Schliwa
>>
>>

Here is a really simpl eexample:
--------------------------------
function recursive, count
print,'count = ',count
if count lt 10 then count = recursive(count+1)
return, count
end

; main
print,'End result = ',recursive(0L)
end

-----------------------------------
save as recursive.pro and start this with .r recursive, and it will run.
In you rcase,
you might need to include a FORWARD_FUNCTION statement as the first line
in h_wahl. That
shoul dhelp.

Regards,
Martin

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: calling a function in herself [message #20889 is a reply to message #20881] Mon, 31 July 2000 00:00 Go to previous message
J�rg Schliwa is currently offline  J�rg Schliwa
Messages: 12
Registered: April 2000
Junior Member
OF course it has to be in the example:
Function H_Wahl,a,b,Steig=steig,Abstand=abstand

so that was not the error!


J�rg Schliwa <joerg.schliwa@ewetel.net> schrieb in im Newsbeitrag:
8m4c9b$3h9$1@ac1.ewetel.de...
> Hy to all!
>
> I have a file with the main-procedure and some functions in it. When I'm
in
> the function e.g h_wahl I want to call the function h_wahl again. Is that
> possible? When I compile the file, the expression h_wahl is not known in
> h_wahl.
>
> e.g.
> ;procedure rasterung.pro
>
> Function H_Wahl(a,b,Steig=steig,Abstand=abstand)
> If Keyword_Set(abstand) Then .....
>
> If Keyword_Set(steig) Then Begin
> ...
> return, H_Wahl(c,d,/abstand)
> Endif
> End
>
> pro rasterung...
>
> Any suggestions?
>
> Thanks in advance,
> J�rg Schliwa
>
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: xinteranimate
Next Topic: Re: Strange PRINTER Coordinates

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

Current Time: Wed Oct 08 19:47:31 PDT 2025

Total time taken to generate the page: 0.00728 seconds