Post Reply 
HP 48GX Indefinite Loops
03-28-2022, 04:11 AM
Post: #3
RE: HP 48GX Indefinite Loops
(03-28-2022 01:11 AM)MNH Wrote:  ...While POS isn't zero the loop continues. My program fails because the loop executes one more time, and there's no starting position for the final SUB. Any thoughts?

If you're using the WHILE-REPEAT-END construct, keep in mind that REPEAT will take the value it's checking from the stack. You'd almost certainly want to make a copy of that value before REPEAT is executed so that you can use it later as needed. The "execution clause" between REPEAT and END definitely won't be executed if there's a 0 in stack level 1 when REPEAT is executed. Any value other than 0 (including negative numbers) will cause the execution clause to execute.

Seeing your code in context along with sample input would be helpful to see what you're trying to do and perhaps why things aren't working as expected.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 48GX Indefinite Loops - MNH - 03-28-2022, 01:11 AM
RE: HP 48GX Indefinite Loops - MNH - 04-02-2022, 02:15 PM
RE: HP 48GX Indefinite Loops - DavidM - 03-28-2022 04:11 AM
RE: HP 48GX Indefinite Loops - DavidM - 03-29-2022, 12:30 PM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 01:59 AM
RE: HP 48GX Indefinite Loops - DavidM - 04-03-2022, 10:58 AM
RE: HP 48GX Indefinite Loops - DavidM - 04-03-2022, 11:39 AM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 05:39 PM
RE: HP 48GX Indefinite Loops - ttw - 03-30-2022, 01:02 AM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 12:57 PM
RE: HP 48GX Indefinite Loops - MNH - 04-03-2022, 04:25 PM



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