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

Home » Public Forums » archive » Re: Beginner fails miserabley at first hurdle 0
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Beginner fails miserabley at first hurdle 0 [message #10923] Wed, 04 February 1998 00:00
a2652099 is currently offline  a2652099
Messages: 10
Registered: August 1996
Junior Member
clovis21@hotmail.com wrote:

> Hello all, I'm just starting, but I've come unstuck already. I'm
> trying to write a for .. do begin line, but I can't seem to get it to
> work:
>
>
> for i=0, 31 do $
> for k=0, 31 do $
> for j=0, 255 DO BEGIN
> real_b(i, k, j)=b(i, k, 2*j)
> imag_b(i, k, j)=b(i, k, (2*j)+1)
> print, i, k, j
> endfor
>
> In desperation I've tried the following:
>
> for i=1, 100 do begin
> print, i
> endfor
>
> and all that happens is that I get 101 printed, then a syntax error on
> the 'n' of endfor. What have I done wrong?

Um, looks to me as if you are entering this at the command line, right?
Then you should try
for i=1, 100 do begin print, i & endfor

The & tells IDL that there is something following.

The other (usual) way would be to put the stuff into a file, e.g.
test.pro, which looks like this:

pro test
for i=0, 31 do $
for k=0, 31 do $
for j=0, 255 DO BEGIN
real_b(i, k, j)=b(i, k, 2*j)
imag_b(i, k, j)=b(i, k, (2*j)+1)
print, i, k, j
endfor
end

When you then enter 'test' at the command line, this file will be
compiled, and the procedure test will be executed.

Or you skip the first 'pro test' line, and start the program with '.run
test'.


Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Fun with CDF_ENCODE_EPOCH
Next Topic: Re: More teething problems

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

Current Time: Wed Oct 08 18:07:26 PDT 2025

Total time taken to generate the page: 0.00419 seconds