Home »
Public Forums »
archive »
Re: Hey! Pssst! Wanna see something wierd?
Re: Hey! Pssst! Wanna see something wierd? [message #8010] |
Sat, 01 February 1997 00:00 |
Runar J|rgensen
Messages: 6 Registered: December 1995
|
Junior Member |
|
|
David Fanning wrote:
>
> Alright you IDL gurus. Explain this!
>
> number = STRING(10)
> FOR j=0, number DO PRINT, 'Cool...!'
>
> Weird, huh. IDL reads my mind! :-)
>
> David
Guru stuff are way out of my league, but I'll never learn anything if
I don't stick my neck out sometimes. Right? :-)
Quote: "The result of an operation becomes the same type as the operand
with the greatest precedence or potential precision."
IDL's User guide (Ver. 4) pp: 4-3
The precedence list of the 8 atomic data types stacks "string" as the
type
with least precedence. So I guess, since 0 is an integer 'number' is
coverted
to an integer (two steps up on the list) and prints 11 'Cool...!'s.
"weird"? Mnjaaa...? but definitely hazardous
Runar
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-
Runar Jorgensen ||
University of Oslo || Phone: +47 2285 5664
Department of Physics || Telefax: +47 2285 5671
P.O.Box 1048 Blindern || email: runar.jorgensen@fys.uio.no
0313 Oslo; Norway ||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-
|
|
|
Current Time: Wed Oct 08 19:23:09 PDT 2025
Total time taken to generate the page: 0.00351 seconds