04-04-2019 07:17 PM
I am making a program and I want to be able to ask at the beginning what you want to do. But there is no lbl or goto like in Ti-Basic, I just started programming my HP Prime so any help is appreciated. (;
04-04-2019 11:58 PM
No, there is no GOTO in PPL...
PPL is what is called a "structured" language (sometimes refered to as 3rd generation languages). GOTOs are replaced by if/then/else and loop type constructs. GOTO are a "hallmark" or 2nd generation languages.
It is generally thought/admited that GOTO are "bad" as they can be used to generare very hard to understand code, and this is a reason why they have been removed from 3rd generation languages.
Another (less publicised reason) is that GOTO are VERY hard to implement in a structured language :-)
Anyhow, GOTO are still present in modern versions of languages like C or Pascal (it was not in the first versions), but their use is generally frowned upon because they usually indicate a "dirty" algorythm.
There is ONE case were goto are not frowned upon in modern programming. When you need to break from an inside loop of a double (or more) loop system. Most languages will only allow you to "break" out of the inner loop. but not out of 2 (or more loops)... However, PPL DOES have a break(n) that allows you to do so. So this need for GOTO goes away.
FOR A=0 TO 10 DO
FOR B=0 TO 10 DO
IF A=5 AND B=6 THEN BREAK(2); END;
Anyhow, this explains, but does not "fix" your problem :-( I assume.
What you will need to do is look at your program and try to understand what the various GOTO are used for. If then else? loops, what type of loop? and translate them in structured statements.