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

Home » Public Forums » archive » assignment inside boolean expression
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: assignment inside boolean expression [message #20709 is a reply to message #20613] Tue, 18 July 2000 00:00 Go to previous messageGo to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Patrick Broos wrote:
>
> I was wondering if it's common knowlege that one can put an IDL
> assignment inside
> a boolean expression (like in the C language). For example
>
> if (v = 0) then ... assigns v and does not execute the "then"
> statement, while
> if (v = 1) then ... assigns v and does execute the then.
>
> Just as in C I find this leads to really nasty bugs.
>
> --

One application where I am actually using this is token search in
strings. It
can save you a few keystrokes and (in my opinion) make code more
readable, because
the temporary variable p is only used within the IF construct:

if ((p=StrPos(test,'Martin')) ge 0) then $
tail = StrMid(test,p,999)

as opposed to

p = StrPos(test,'Martin')
if p ge 0 then tail = StrMid(test,p,999)


--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ 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 [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: optimization question: a faster way to PIXMAP?
Next Topic: Re: Top 10 IDL Requests

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

Current Time: Sat Oct 11 07:48:37 PDT 2025

Total time taken to generate the page: 0.64261 seconds