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

Home » Public Forums » archive » Re: 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 #20593] Tue, 11 July 2000 00:00 Go to previous message
Jeffrey Jones is currently offline  Jeffrey Jones
Messages: 5
Registered: July 2000
Junior Member
In article <396A3790.43C8EB31@astro.psu.edu>, Patrick Broos
<patb@astro.psu.edu> 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.
>
>
> --
> ============================================================ ========
> Patrick S. Broos, Systems Analyst/Programmer patb@astro.psu.edu
>
> Department of Astronomy and Astrophysics My office 814-863-7947
> Penn State University
> 525 Davey Lab FAX 814-863-8686
> University Park, PA 16802-6305
> http://www.astro.psu.edu Group office 863-9550
> ============================================================ ========
>
>
>


The analogy with C only goes so far, it seems.

The following generates a syntax error:

x = 0
while ((x = x+1) lt 10) do print, x

whereas,

x = 10.0
while (x = x - 1.0) do print, x

produces:

9.00000
8.00000
7.00000
6.00000
5.00000
4.00000
3.00000
2.00000
1.00000

--
Jeffrey Jones
Raytheon ITSS
Code 975
NASA/Goddard Space Flight Center
Greenbelt, MD 20771 USA

office: Bldg 33, Rm A428
phone: 301.614.5721
email: jeffrey.a.jones.1@gsfc.nasa.gov

--
Jeff

jajvj@erols.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Standalone IDL applications?
Next Topic: Re: Writing GIF files in IDL ATTN: Paul van Delst, Liam Gumley

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

Current Time: Wed Oct 08 20:14:43 PDT 2025

Total time taken to generate the page: 0.02235 seconds