Post Reply 
an HP question...
10-23-2017, 12:16 PM (This post was last modified: 10-23-2017 12:28 PM by Gilles59.)
Post: #7
RE: an HP question...
(10-23-2017 03:57 AM)webmasterpdx Wrote:  Why does the case command exist since we have to put an if-then-end command for each case? Why not just put the if-then-end commands in a row without the case?
just curious...
Thx
-Donald


I dont like the way CASE is implemented in the Prime.
In langage like Pascal it's easier to understand and read, but perhaps less flexible.

Code:
Case x Of
 1 : do something;
 2 : do someting else ;
 3 : etc;
 Default; ...
End;

or

Code:
Case x Of
 1,2,9: do domething if x=1 ou or x=2 or x=9;
 3..7 : do someting else if x between 3 and 7 ;
 8    : etc;
 Default;
End;

By the way, the CASE instruction is interesting on the PRIME as Didier Lachieze wrote and avoid a succession of imbricated IF THEN ELSE. And if understand well your exemple with RETURN only works if you have a subroutine dedicated to the test cases.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
an HP question... - webmasterpdx - 10-23-2017, 03:57 AM
RE: an HP question... - Arno K - 10-23-2017, 06:35 AM
RE: an HP question... - webmasterpdx - 10-23-2017, 07:13 AM
RE: an HP question... - Didier Lachieze - 10-23-2017, 07:44 AM
RE: an HP question... - Arno K - 10-23-2017, 07:37 AM
RE: an HP question... - webmasterpdx - 10-23-2017, 08:06 AM
RE: an HP question... - Gilles59 - 10-23-2017 12:16 PM
RE: an HP question... - Eddie W. Shore - 10-23-2017, 12:36 PM
RE: an HP question... - webmasterpdx - 10-23-2017, 10:26 PM
RE: an HP question... - webmasterpdx - 10-24-2017, 12:58 AM
RE: an HP question... - webmasterpdx - 10-24-2017, 01:12 AM
RE: an HP question... - webmasterpdx - 10-24-2017, 01:20 AM
RE: an HP question... - webmasterpdx - 10-24-2017, 01:38 AM
RE: an HP question... - webmasterpdx - 10-24-2017, 02:09 AM
RE: an HP question... - webmasterpdx - 10-24-2017, 02:16 AM
RE: an HP question... - Joe Horn - 10-24-2017, 06:21 AM



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