HP Prime speed vs TI-Nspire CX - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: HP Prime speed vs TI-Nspire CX (/thread-7203.html) Pages: 1 2 |
RE: HP Prime speed vs TI-Nspire CX - ttw - 11-09-2016 08:44 AM I use a construct like the following for most programs that do real work. J=1 While (J Ne 0) DO Case j=1 Then.... j = x End j=2 Then.... j = y End j=3 Then.... j=z End End Sort of a pseudo-hp50g code. It allows an arbitrary state machine to be written in Structured Programming. (I don't remember the Prime commands as I no longer use the Prime; trying to update it's memory fried a rather expensive desktop and the Prime was banished.) Without GOTOs, error handling is hard. Most modern languages do have enough constructs to make GOTOs irrelevant. They are not needed for looping or branching. They are really only useful when one needs to jump across contexts without unwinding the whole context (mostly in error handling.) RE: HP Prime speed vs TI-Nspire CX - Marcelo Vanti - 11-09-2016 12:01 PM (11-09-2016 06:48 AM)cyrille de brébisson Wrote: Hello, Hello, I have doubts if I understood correctly, but in Fortran 90 onwards one can do the following: Code: 0| outa: DO RE: HP Prime speed vs TI-Nspire CX - toml_12953 - 11-09-2016 01:00 PM (11-09-2016 08:44 AM)ttw Wrote: Without GOTOs, error handling is hard. In ANSI (ISO) BASIC, error handling is done this way: WHEN EXCEPTION IN <code block> USE <error handling code> END WHEN Contrived simple example: square root error Code: DO No need for GOTO even in error handling. Tom L RE: HP Prime speed vs TI-Nspire CX - Adriweb - 11-09-2016 01:35 PM (11-09-2016 06:48 AM)cyrille de brébisson Wrote: BUT, 90% of my goto use is to exit multiple loops at once, which you can not do in C (or other programming languages)... HOWEVER, you CAN do it in PPL using the BREAK(n) and CONTINUE(n) function!!!! As far as I know, PPL is the ONLY language that has such constructs!!! PHP has this too, and I'm sure others I'm not so familiar with or don't know at all. RE: HP Prime speed vs TI-Nspire CX - StephenG1CMZ - 11-09-2016 08:00 PM For resurrecting old BASIC listings (if only to see what they do before a rewrite) most labels could be restricted to the same procedure... Most old listings with lots of GOTO's made little use of procedures. When I have used GOTO for error handling, I have never needed the context to be preserved: If engine==off and restart()==off goto Failure; ... Failure: Reboot();//or Halt(); RE: HP Prime speed vs TI-Nspire CX - Wes Loewer - 11-10-2016 07:05 PM (11-09-2016 01:35 PM)Adriweb Wrote:(11-09-2016 06:48 AM)cyrille de brébisson Wrote: HOWEVER, you CAN do it in PPL using the BREAK(n) and CONTINUE(n) function!!!! As far as I know, PPL is the ONLY language that has such constructs!!! As does bash. Whenever I use goto to exit a heavily nested C loop, I always add a comment like // break(4) |