RPL equivalents to BREAK, CYCLE, EXIT, etc.?
|
06-07-2014, 11:48 PM
Post: #8
|
|||
|
|||
RE: RPL equivalents to BREAK, CYCLE, EXIT, etc.?
(06-07-2014 06:40 PM)HP67 Wrote: What I was looking for when I opened the thread was an immediate exit from a loop. IFERR seems to be the best (only?) way to do that. RPL seems to have been conceived by those who were probably trained with traditional "structured programming" in mind. There really isn't room for GOTO or BREAK/EXIT/etc. in structured programming. Error trapping is probably the closest you'll get in RPL to what you're seeking. Sometimes you can achieve what you need with a CASE statement as well, but it depends entirely on the situation as to whether that applies. It's almost inevitable that you will need to go back and edit some of your code at some point (or perhaps that of someone else). The more of that you do, the more you'll appreciate how much easier it is to follow code that doesn't have lots of GOTOs (especially) and BREAKs/EXITs. If you start branching into SysRPL, there's a handful of commands that can be used to perform similar functions to BREAK/EXIT. Used creatively, you can do some amazing things with those commands. See all of Chapter 19 (Runstream Control) in "Programming in System RPL" by Eduardo M Kalinowski and Carsten Dominik. While those commands are useful, they can also make your code very difficult to read and understand later. You have been warned. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)