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

Home » Public Forums » archive » Re: Begin statement
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: Begin statement [message #3260 is a reply to message #3259] Wed, 04 January 1995 16:02 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
hartl@clouzot.imo.physik.uni-muenchen.de (Ingmar Hartl) writes:

> In article <hahn.74.00145964@hrz.th-darmstadt.de> hahn@hrz.th-darmstadt.de (Norbert Hahn) writes:
>> and it looks as if begin is immediately followed by end:
>> IDL> repeat begin
>> All rights reserved. Unauthorized reproduction prohibited.
>> & END
>> ^
>> % Syntax error.

> Same happened to me.

> It worked, after I wrote a procedure with this statements.

> I think, it is only allowed to use BEGIN and END statements
> in procedures and functions. I found nothing to this point
> in the User's Guide...

> Ingmar Hartl.

Actually, on can use BEGIN and END statements from the command line, but one
has to fit in the entire command onto a single command line, e.g.

IDL> FOR I=1,10 DO BEGIN & PRINT,I & HELP,I & ENDFOR

(It actually doesn't matter if one uses END or ENDFOR. Always remembering to
use ENDFOR, ENDIF, ENDWHILE, etc. leads to more readable code and makes it
easier for IDL to point out where any errors might occur.)

If one only wants a single statement within a FOR loop, then one can omit the
BEGIN and ENDFOR statements, e.g.

IDL> FOR I=1,10 DO PRINT,I

If one can't fit the entire loop onto a single line, then one needs to write a
procedure, either by editing a file or by using .RUN, e.g.

IDL> .RUN
- FOR I=1,10 DO BEGIN
- PRINT, I
- HELP, I
- ENDFOR
- END

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 3D graphics
Next Topic: PRINT_FILE keyword in MS-WINDOWS ???

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

Current Time: Fri Oct 10 02:30:45 PDT 2025

Total time taken to generate the page: 0.72231 seconds