× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Luke,

It used to be that GOTO was the only way to do things like loops in a
program (as it basically still is with CL). But injudicious use of GOTO can
create 'spaghetti code', where it's very difficult to figure out what's
going where, with lots of GOTO's skipping backwards and forwards. Once we
got 'better' alternatives, GOTO was 'outlawed' by many programmers as being
A BAD THING.

I guess I'd say that the odd GOTO here and there isn't the worst thing in
the world, but it's very rare that you'd need them anyway - there are
always better alternatives. Likewise with CABxx.

I think the key statement from your question is where you say "Sometimes it
is very readable IMHO..." Yes, sometimes it is. But as often as not, it
isn't very readable, and it's better/easier to just not use GOTO at all and
use a better alternative.

FWIW, lots of the alternatives are really GOTO's in disguise - ITER, LEAVE,
EXSR, LEAVESR and even the assorted DO and FOR loops. The underlying code
(MI for RPGIII, W-code for RPGIV, I think) generate complex GOTO-equivalent
statements. The difference is that we, the RPG programmers, don't see all
of that - all we see is, e.g. a nice FOR loop, without all the low-level
setting/checking/incrementing of variables.

Rory

On Mon, Sep 10, 2012 at 7:18 AM, Klugman, Luke
<LKlugman@xxxxxxxxxxxxxxxxx>wrote:

I don't understand -= since I have been programming in RPG I have always
got the impression that a GOTO is a no no and have never used it? BUT
what's so wrong with using it? I don't really understand why everyone
shuns it so much...
Sometimes it is very readable IMHO...

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.