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

Home » Public Forums » archive » CASE statement
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: CASE statement [message #26938 is a reply to message #26552] Wed, 03 October 2001 23:51 Go to previous messageGo to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
David Fanning wrote:
>
> George McCabe (george.mccabe@gsfc.nasa.gov) writes:
>
>> ;+
>> ; PURPOSE:
>> ; "On or Off", turn any variable into a strict logical type
>> ; with only two values 0 or 1
>> ;
>
> Impressive code, George. But couldn't this be
> more simply done with this:
>
> on_off = Keyword_Set(variable)
>


Hi David and all others,


the most problem with all these functions arg_present, n_elements,
keyword_set
is that's most beginners believe that's some of them only works by
keywords
and some only for positional parameters.

To learn something about IDL and its parameters here are two exercises
of our course.


regards

Reimar


1)
There are three functions given



FUNCTION test1,minimum=min_val
IF KEYWORD_SET(min_val) THEN RETURN,1 ELSE RETURN,0
END


FUNCTION test2,minimum=min_val
IF ARG_PRESENT(min_val) THEN RETURN,1 ELSE RETURN,0
END


FUNCTION test3,minimum=min_val
IF N_ELEMENTS(min_val) GT 0 THEN RETURN,1 ELSE RETURN,0
END

Fill out the form:




CALL | test1 | test2 |test3
____________________________________________________________ ____
PRINT, testX( ) | | |
____________________________________________________________ ____
PRINT, testX(minimum=0) | | |
____________________________________________________________ ____
PRINT, testX(minimum=10) | | |
____________________________________________________________ ____
PRINT, testX(minimum=-10) | | |
____________________________________________________________ ____
mv=0 & PRINT, testX(minimum=mv) | | |
____________________________________________________________ _____
mv=10 & PRINT, testX(minimum=mv) | | |
____________________________________________________________ _____
PRINT, testX(minimum=mv2) | | |
____________________________________________________________ _____





2)
There are three functions given



FUNCTION test1,min_val
IF KEYWORD_SET(min_val) THEN RETURN,1 ELSE RETURN,0
END


FUNCTION test2,min_val
IF ARG_PRESENT(min_val) THEN RETURN,1 ELSE RETURN,0
END


FUNCTION test3,min_val
IF N_ELEMENTS(min_val) GT 0 THEN RETURN,1 ELSE RETURN,0
END

Fill out the form:




CALL | test1 | test2 |test3
____________________________________________________________ ____
PRINT, testX( ) | | |
____________________________________________________________ ____
PRINT, testX(0) | | |
____________________________________________________________ _____
PRINT, testX(10) | | |
____________________________________________________________ ____
PRINT, testX(-10) | | |
____________________________________________________________ ____
mv=0 & PRINT, testX(mv) | | |
____________________________________________________________ _____
mv=10 & PRINT, testX(mv) | | |
____________________________________________________________ _____
PRINT, testX(mv2) | | |
____________________________________________________________ _____



--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======

read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL LINUX support question
Next Topic: interpol

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

Current Time: Sat Oct 11 09:46:35 PDT 2025

Total time taken to generate the page: 0.16322 seconds