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

Home » Public Forums » archive » Re: input expression as a variable.
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: input expression as a variable. [message #50620] Fri, 06 October 2006 13:23
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
queiny98@yahoo.com writes:

> May I read in an expression and then used it in the 'IF' or 'WHILE' or
> 'CASE'?

Not directly, no.

> For example, may I define the expression first, then use it? Or read in
> expressions from standard input or input files?
>
> expr1=' a gt 3'
>
> if(expr1) then do begin
> ******
> endif

No, but if have no objections to using EXECUTE, you could do
this in two steps:

expr1=' a gt 3'
ok = Execute('test = ' + expr1)
IF ~ok THEN RETURN

if(test) then do begin
******
endif


> May I use something like:
>
> readf, in_unit, expr1

No.

> or
>
> readf, expr1, prompt='Enter Condition:'

No.

> so, the 'expr1' can be defined more flexiable.

Be careful not to be TOO flexible. The variable you
are testing against will have to be defined in the program
module you use it in.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: input expression as a variable.
Next Topic: call_procedure with a dynamically created arguments list?

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

Current Time: Wed Oct 08 17:36:21 PDT 2025

Total time taken to generate the page: 0.00557 seconds