Post Reply 
System RPL - How to exit indefinite loop?
07-25-2021, 07:45 PM
Post: #7
RE: System RPL - How to exit indefinite loop?
(07-25-2021 04:11 PM)Strike1 Wrote:  I had decided to change the BEGIN - AGAIN loop to a BEGIN - WHILE - REPEAT loop. Surprisingly it worked. It let me insert the test clause (I employed a User Flag) and it cleanly let me drop out of the loop. Now that you've given me something to study I will try to figure out the merits of a different approach to dropping out of either type loop.

When there's a single decision point, BEGIN...WHILE...REPEAT is usually the better choice for clarity, but you can sometimes save some bytes by using alternate methods.

There's also those times when you may already be doing something with the return stack (such as processing a list), and a hybrid approach may be needed.

Since you mentioned using Debug4x, be aware that the compiler may complain about unmatched codewords if you start mixing up the looping commands. It also automatically includes the :: ; tokens in a BEGIN...WHILE...REPEAT sequence, so you shouldn't put those at the outermost level between WHILE and REPEAT in most cases. You may also have to put the codewords in [] to keep the compiler from getting confused by non-standard constructs.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: System RPL - How to exit indefinite loop? - DavidM - 07-25-2021 07:45 PM



User(s) browsing this thread: 1 Guest(s)