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

Home » Public Forums » archive » probable mistake in IDL manual
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
probable mistake in IDL manual [message #10382] Fri, 28 November 1997 00:00 Go to previous message
szoonem is currently offline  szoonem
Messages: 16
Registered: June 1995
Junior Member
Hi,

I was reading "Building IDL Applications" manual (version 5) and noticed
the procedure on p. 76 which is supposed to count the number of times that
the word "dog" appears in the string "dog cat duck rabbit dog cat dog";

------
pro Animals
animals = 'dog cat duck rabbit dog cat dog'
i = 0
cnt = 0
while (i ne -1) do begin
i = strpos(animals,'dog', i)
if (i ne -1) then cnt = cnt + 1
endwhile
print, 'Found ',cnt, "occurances of 'dog'"
end
------

When I read it, it struck me as being wrong. I tested it later and it
seems to have gone into an infinite loop (as I suspected it would). Is it
some thing VERY obvious that I am missing or is it simply wrong?

I am rather confused about this simple procedure. Any comments would be
appreciated,

- Saeid

------------------------------------------------------------ -----
| Saeid Zoonematkermani | E-Mail: szoonem@astro.sunysb.edu |
| Dept. of Physics & Astronomy | Voice: (+1) (516) 632-8237 |
| State University of New York | Fax: (+1) (516) 632-8742 |
| Stony Brook, NY 11794-3800 | |
------------------------------------------------------------ -----
| Home Page --> http://ozone.ess.sunysb.edu/ |
------------------------------------------------------------ -----
[Message index]
 
Read Message
Read Message
Previous Topic: pv-wave 5.00,scaling
Next Topic: Pixel Information

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

Current Time: Fri Oct 10 10:53:36 PDT 2025

Total time taken to generate the page: 1.76114 seconds