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

Home » Public Forums » archive » keyword question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
keyword question [message #25218] Wed, 23 May 2001 09:07
Randall Skelton is currently offline  Randall Skelton
Messages: 169
Registered: October 2000
Senior Member
Greetings all,

I am trying to have an array *optionally* returned using a keyword
and I don't know the dimension of the array prior to the call. Why is
it that the passed keyword needs to be defined in IDL prior to being used
as a keyword?

What am I doing wrong here?

Cheers,
Randall

Here is an example:
---
function test, a, b=b
a = 1.0
if (keyword_set(b)) then b = fltarr(10)
return, 1
end
--

***This works as I'd expect:
IDL> print, test(a) && help, a
1
A FLOAT = 1.00000

***This does not work as I expect:
IDL> print, test(a,b=duh) && help, a, duh
1
A FLOAT = 1.00000
DUH UNDEFINED = <Undefined>

***This works which makes me mad:
IDL> duh = 1
IDL> print, test(a,b=duh) && help, a, duh
1
A FLOAT = 1.00000
DUH FLOAT = Array(20)
[Message index]
 
Read Message
Previous Topic: Re: Locate an underflow
Next Topic: Re: keyword question

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

Current Time: Wed Oct 08 22:26:53 PDT 2025

Total time taken to generate the page: 0.48264 seconds