Precisely Speaking
February 04, 2012, 07:10:15 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: So what's news with you? Tell us about it in "Getting To Know You"!
Home
Help
Calendar
Login
Register
Precisely Speaking
>
Training and Education
>
U2 Programming Questions
>
CONTINUE loops the program
Pages: [
1
]
Go Down
« previous
next »
Print
Author
Topic: CONTINUE loops the program (Read 1310 times)
DonQuixote
Uber-Pro
Posts: 99
To Dream the Impossible Dream...
CONTINUE loops the program
«
on:
March 18, 2010, 09:39:32 AM »
I can't imagine why this is true; but it is.
UniData. If you write a Basic program and put a CONTINUE statement with no associated LOOP the entire program executes again. Unbelievable but true.
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
Posts: 1524
Re: CONTINUE loops the program
«
Reply #1 on:
March 19, 2010, 06:32:03 AM »
No kidding? What version?
Logged
-Kevin
Accidents "happen"; success, however, is planned and executed.
DonQuixote
Uber-Pro
Posts: 99
To Dream the Impossible Dream...
Re: CONTINUE loops the program
«
Reply #2 on:
March 19, 2010, 11:28:09 AM »
UniData RDBMS 6.1
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
Posts: 1524
Re: CONTINUE loops the program
«
Reply #3 on:
March 19, 2010, 12:04:03 PM »
Wow. I did this on Unidata 7.1:
PRINT 'XYZ'
CONTINUE
...and found myself inside an endless loop. See, that just goes to show the value of my standard advice to avoid CONTINUE and EXIT, right?
Logged
-Kevin
Accidents "happen"; success, however, is planned and executed.
Tom Pellitieri
Rock Star
Posts: 165
Tom Pellitieri - Toledo, Ohio
Re: CONTINUE loops the program
«
Reply #4 on:
March 19, 2010, 01:40:20 PM »
I'm guessing that CONTINUE jumps to the start of the current loop. Since the program example you've provided has no loop, that would be the start of the program - which is why you get an infinite loop.
UniData help states: "Tip: Use CONTINUE instead of GOTO in structured programs", and suggests that it makes the code easier to read and maintain. To my mind, however, the CONTINUE statement is merely a GOTO statement with an implied label! I find that the CONTINUE statement makes a program harder to follow, not easier, since I have to find the start AND end of the containing loop. Rather than use:
IF (TEST = 1) THEN CONTINUE
(more stuff)
I would prefer to see
IF (TEST # 1) THEN GOSUB DO.STUFF
...
DO.STUFF:
(more stuff)
RETURN
Naturally, I try to avoid GOTO statements. The one exception for me (at this point - don't look at my code from 10 years ago!) is to use GOTO ERR.EXIT or GOTO PGM.EXIT to gracefully abort a routine without having excessively nested "IF-THEN-ELSE" structures. I would choose a "self documenting" GOTO over an ambiguous CONTINUE any day.
--Tom
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
Posts: 1524
Re: CONTINUE loops the program
«
Reply #5 on:
March 19, 2010, 01:51:17 PM »
Quote from: Tom Pellitieri on March 19, 2010, 01:40:20 PM
I would choose a "self documenting" GOTO over an ambiguous CONTINUE any day.
Here Here!!
Logged
-Kevin
Accidents "happen"; success, however, is planned and executed.
DonQuixote
Uber-Pro
Posts: 99
To Dream the Impossible Dream...
Re: CONTINUE loops the program
«
Reply #6 on:
March 30, 2010, 08:58:41 AM »
Its so gratifying to know people like you.
Logged
slestak
Uber-Pro
Posts: 69
Re: CONTINUE loops the program
«
Reply #7 on:
May 07, 2010, 02:29:42 PM »
I like the CONTINUE, but I always follow it with a comment, i.e.
CONTINUE;* release loop
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
Posts: 1524
Re: CONTINUE loops the program
«
Reply #8 on:
May 07, 2010, 03:22:19 PM »
(with all due respect to old commercials...)
If you must drink, drink Dos Equis.
If you must drink and drive, drink Pepsi.
If you must jump somewhere in a program (in any form), use a comment.
Logged
-Kevin
Accidents "happen"; success, however, is planned and executed.
Pages: [
1
]
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Getting To Know You
=> Announcements
=> Big Thoughts / Cool Ideas
=> Rants & Raves
-----------------------------
Application Support
-----------------------------
=> Red Leaf
=> Activant/Prelude Support
=> Summit Support
=> Avante Support
=> PRC Support
-----------------------------
Training and Education
-----------------------------
=> Connect!
=> U2 Programming Questions
=> SB+ Programming Questions
=> Web Programming Questions
=> Business Intelligence / MITS
=> PC / Hardware / Miscellaneous Support
Loading...