Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!icdoc!cc.ic.ac.uk!umapd51 From: umapd51@cc.ic.ac.uk (W.A.C. Mier-Jedrzejowicz) Newsgroups: comp.sys.handhelds Subject: Re: BREAK and RETURN on the 48sx: where are they? Summary: Not built in, but can be simulated. Keywords: Structured programming Message-ID: <1990Dec19.041347.26105@cc.ic.ac.uk> Date: 19 Dec 90 04:13:47 GMT References: <8601@dog.ee.lbl.gov> Sender: Wlodek Mier-Jedrzejowicz Organization: Imperial College Computer Centre Lines: 31 Nntp-Posting-Host: suni2cc The author asks - where are BREAK and RETURN on the HP48 - is he missing something very basic? Well, yes Matthew, you are missing something very basic - the designers of the RPL language believe deeply in structured programming where blocks of code have only one entry point and one exit point. This IS the basic point - so there is no method designed to let you break out of a loop or return before the end of a subprogram. Providing such commands would be contrary to the nature of the language. This is not to say there is anything intrinsically wrong with BREAK or RETURN - and being a typical HP hacker, I wondered how these could be achieved - in fact I am writing a series of articles on that very topic right now in DATAFILE (the journal of the British club for users of HP handhelds - available to members regularly 8 times a year). Bill Wickes himself provides some very welcome clues in his book HP41/HP48 Transitions. One example is that an error in an IFERR causes the rest of the IFERR to be skipped - and you can use DOERR to force an error where you wish - this combination lets you BREAK out of a block of code if you want to do that. Other tricks are available too, and are mentioned in passing in Bill's book. You can try causing an error in a subprogram to leave that subprogram prematurely too. Alternatively, you can treat RPL as a language which forces you to learn structured programming with only one entry point and one exit point per block of code - it is quite interesting to learn how this can be done if you are coming from an unstructured language, such as FORTRAN. Best Wishes, Wlodek Mier-Jedrzejowicz, Space & Atmospheric Physics, Imperial College, London.