comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Hey! Pssst! Wanna see something wierd?

Re: Hey! Pssst! Wanna see something wierd?
type: item
description: 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 || -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-
creator: Runar J|rgensen
date: 1997-02-01T08:00:00-00:00