Andre3W Honor Student
Honor Student
2 0 0 0
Message 1 of 2
177
Flag Post
HP Recommended

Is there any way I can use goto in hp prime

HP Prime

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. (;

1 REPLY 1
Grad Student Grad Student
Grad Student
190 189 34 64
Message 2 of 2
150
Flag Post
HP Recommended

Is there any way I can use goto in hp prime

Hello,

 

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.

example:

FOR A=0 TO 10 DO

  FOR B=0 TO 10 DO

    IF A=5 AND B=6 THEN BREAK(2); END;

  END;

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.

 

Cyrille

I am an HP Employee
Reply
0 Kudos
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation