STRINGFROMID and gradians - 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: STRINGFROMID and gradians (/thread-11414.html) Pages: 1 2 |
RE: STRINGFROMID and gradians - cyrille de brébisson - 09-21-2018 09:44 AM Hello, "I wouldn't mind an HPPL GOTO statement! Even C has GOTO and it would make translating programs to HPPL easier in some cases." Unfortunately, this will not happen, at least not anytime soon. Not because I do not like gotos or anything like that (I have done enough Basic or ASM to know their worth), but because GOTO are actually VERY dificult to implement in a language which has scopes, local variables and the like... However, since you are talking about goto C, if you look at "non messy code" (ie, code that is reasonably clean) and look at the GOTO usage, you will see that >80% of them are there to cover a single situation. The exit of the inside of a double (or deeper) loop. Something along the lines of: for all elements in a list for all elements in a sub-list if something, then do it and stop searching (goto end) end:; in C, you either have to create boolean and set them in the inner loop and test it in the outer loop, or do a GOTO... However, in HPPL, you have the EXIT(n) construct which does exactly that for you (CONTINUE(n) is also available) So, most uses of GOTO are already covered in a much cleaner way... This does not mean that a GOTO would not be nice, but the lesser need of the functionality makes the implementation investment not really worth it... Cyrille RE: STRINGFROMID and gradians - StephenG1CMZ - 09-21-2018 02:44 PM One point to remember though is that if you then surround those two FOR loops with a third FOR loop, your EXIT(2) will now be taking you to the wrong place - the middle, not the end -, if I am not mistaken... Whereas a GOTO end; - you can see exactly where you are going to, without having to count lots of ENDFOR's, making the code arguably more readable and needing less edits. RE: STRINGFROMID and gradians - CyberAngel - 09-21-2018 04:49 PM (09-21-2018 02:44 PM)StephenG1CMZ Wrote: One point to remember though is that if you then surround those two FOR loops with a third FOR loop, your EXIT(2) will now be taking you to the wrong place - the middle, not the end -, if I am not mistaken...Problem with EXIT(2)? There's no difference compared to the formal loop exit. The execution continues after the loop END; What is your problem? Please, explain. RE: STRINGFROMID and gradians - StephenG1CMZ - 09-21-2018 05:47 PM Maybe I'm wrong - I don't use EXIT often. But Code:
It could be I have misunderstood how EXIT works, but a GOTO looks like MUCH less effort. Update: In PPL its BREAK or CONTINUE, apparrently, not EXIT - Thanks Cyberangel. RE: STRINGFROMID and gradians - CyberAngel - 09-21-2018 09:04 PM CONTINUE & BREAK RE: STRINGFROMID and gradians - Tyann - 09-22-2018 02:37 PM (09-21-2018 05:47 PM)StephenG1CMZ Wrote: Maybe I'm wrong - I don't use EXIT often. Bonjour Dans ce cas il peut-être utile d'utiliser une variable, il suffira de modifier la valeur de cette variable plutôt que tous les BREAK. De plus vous pourrez si vous avez plusieurs points de sortie les repérer grâce à un commentaire. Hello In this case it may be useful to use a variable, it will be enough to modify the value of this variable rather than all the BREAKs. Moreover you will be able if you have several points of exit to locate them thanks to a comment. exemple : Code:
RE: STRINGFROMID and gradians - StephenG1CMZ - 09-26-2018 03:17 PM (09-19-2018 08:12 AM)Tim Wessman Wrote: Note that these string names are NOT final and guaranteed to be supported long term. For example, in the "modes" group there are a bunch of spreadsheet items that need to be moved. That sounds quite useful... If you are taking suggestions for new languages to support, in England, Polish is a significant minority language - but that might change if/when the uk leaves the EU. Er, can these planned language modifications be selected whilst in Exam mode? RE: STRINGFROMID and gradians - Tim Wessman - 09-27-2018 12:17 AM Unfortunately not, however if a translation was advanced enough to be reviewed it could potentially pulled in as supported. Until then, not really due to the potentially for abuse. |