Post Reply 
RPL equivalents to BREAK, CYCLE, EXIT, etc.?
06-08-2014, 06:05 PM
Post: #14
RE: RPL equivalents to BREAK, CYCLE, EXIT, etc.?
(06-08-2014 04:05 PM)DavidM Wrote:  Whether using these alternatives makes code more readable/maintainable is a purely subjective issue. In my opinion, it does.

This program checks whether a number is prime:
Code:
\<< 2 OVER \v/
  IFERR
    FOR n
      IF DUP n MOD NOT
      THEN DOERR
      END
    NEXT DROP
  THEN 0
  ELSE 1
  END
\>>

How would you make it more readable?

Cheers
Thomas

PS: I'm aware of the shortcomings of the program. I just wanted to provide an example that is simple but still useful.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPL equivalents to BREAK, CYCLE, EXIT, etc.? - Thomas Klemm - 06-08-2014 06:05 PM



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