Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code-How to stop a procedure

Status
Not open for further replies.

Sadoscar

Instructor
Oct 18, 2005
6
0
0
LT
Hi every body.
look at this code
Set(File1,1)
Loop until eof(File1)
......
Instructions
.......
End

After bigining of this code i realise that there is a variable that was not specified.
I'd like to stop a procedure when a Loop.......End code is runing.
Is there a way to stop it.
Regards
Sad
 
Hi Sad,

The way to come out of a LOOP is to use the BREAK statement. A CYCLE returns to the start of the LOOP.

LOOP
NEXT(File)
IF ERRORCODE() THEN BREAK.
IF <breakcondition> THEN BREAK.
IF <cyclecondition> THEN CYCLE.
....
END

Also using LOOP UNTIL EOF(File) is bad for performance. Use

LOOP
NEXT(File)
IF ERRORCODE() THEN BREAK.
....
END

instead.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top