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

Home » Public Forums » archive » Re: Single Quotes, Double Quotes
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: Single Quotes, Double Quotes [message #11760 is a reply to message #11757] Thu, 14 May 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Charles Cavanaugh (cavanaug@nicole.eos.ucar.edu) writes:

> Can anyone please explain to me why the line
>
> asciiutc = "1993-09-19T06:30:00.000000Z"
>
> fails compilation with the error message
>
> asciiutc = "1993-09-19T06:30:00.000000Z"
> ^
> % Syntax error.
>
> but the same line, using single quotes instead of double
> quotes, compiles.

I don't know the "official" answer, but I suspect it has
to do with the way octal and hexadecimal numbers are
specified in IDL.

For example, to create a hexadecimal number:

IDL> a = "f4"x
IDL> print, a
244

Or, an octal number 12:

IDL> a = "12
IDL> print,a
10

Thus, if the "thing" you are assigning to a variable
is a number (but you want it as a string), you must use
single quotes or it will be mistaken for a hexadecimal
or octal number. For example, this fails:

IDL> a = "5"
a = "5"
^
% Syntax error.

But this works:

IDL> a = '5'

And this works, because the first thing after the double
quote is a letter:

IDL> a = "A5"

Not sure this "explains" it. But perhaps it illuminates the
problem enough to suggest a solution. :-)

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: contour and backingstore
Next Topic: IDL Object Graphics Update

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

Current Time: Fri Nov 28 21:48:32 PST 2025

Total time taken to generate the page: 6.56799 seconds