Post Reply 
newRPL - build 1255 released! [updated to 1299]
06-11-2019, 12:42 PM
Post: #498
RE: newRPL - build 1255 released! [official and unofficial]
(06-09-2019 12:10 PM)Gilles Wrote:  Claudio, did you think that a 'RETURN' command could be introduce in the future?
'return' exists in most langage and in PPL. The idea is to be able to exit a command/fonction at any time with the stack as it is, even in the middle of nested loops and IF/CASE.... I imagine this is not obvious because the program have to exit all and to deal with internal stuff in a proper way.

In fact, it could be seen as a kind of EXIT (wich is a advantage of newRPL vs RPL) but not only for a loop but for a full command/function. (or like a local KILL)

Usage case is :

Code:
a b START
 c d START
  MyStuff
  IF DidIgetIt? THEN MyResult RETURN END 
 NEXT
NEXT
OtherThings

Without RETURN and with EXIT you have to use a flag or a local variable and awfull things like :

Code:
1 CF
a b START
 c d START
  MyStuff
  IF DidIgetIt? THEN MyResult 1 SF EXIT END 
 NEXT
 IF 1 FS? THEN EXIT END
NEXT
IF 1 FS? THEN EXIT END
OtherThings

EXIT will also return from the current program but it can only exit one program at a time. RPL has no function markers so there is no way to know how many secondaries RETURN is supposed to exit:

Code:

<<
 <<
 <<
 << mycode RETURN >>
@ Do we return here? Same as EXIT
>>
@ Or here?
>>
@ why not here?
>>
@ Is this the end of the function?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL - build 1001 released! - pier4r - 12-16-2017, 08:03 AM
newRPL - on Hp 39gs - Martin Hepperle - 06-05-2019, 06:51 AM
RE: newRPL - build 1001 released! - pier4r - 12-23-2017, 10:16 AM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 09:42 AM
t - Claudio L. - 01-01-2018, 03:06 PM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 03:41 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 04:54 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 06:58 PM
newRPL - brickviking - 10-05-2018, 06:01 AM
RE: newRPL - build 1255 released! [official and unofficial] - Claudio L. - 06-11-2019 12:42 PM
How to participate? - erazor - 12-13-2019, 07:12 AM



User(s) browsing this thread: 2 Guest(s)