The Museum of HP Calculators

HP Forum Archive 21

 HP 39gii: CASE SyntaxMessage #1 Posted by Eddie W. Shore on 18 Feb 2013, 10:48 p.m. I am trying to get a program where the user chooses to calculate the area between three shapes (circle, ring, and ellipse). Here is the sample code: ```EXPORT AREAS() BEGIN RECT(); CHOOSE(C," ", "Circle"); CASE IF C==1 THEN INPUT(R); PRINT(string(pi*R^2)); END; END; END; ``` I tried this with a semicolon with the first END, without the semicolon in the first END, but the result is the same: Syntax error. The online help/manual does not help. Any ideas? Thanks.

 Re: HP 39gii: CASE SyntaxMessage #2 Posted by Thomas Radtke on 19 Feb 2013, 1:34 a.m.,in response to message #1 by Eddie W. Shore I don't have a 39gii, so excuse my ignorance: Does CHOOSE work with just one option to choose from? Allthough unlikely, I imagine that could be a problem.

 Re: HP 39gii: CASE SyntaxMessage #3 Posted by Gilles Carpentier on 19 Feb 2013, 1:57 a.m.,in response to message #1 by Eddie W. Shore Hi Eddy, The CASE command dont work. It is a bug. I hope this to be corrected in the next ROM You must use imbricated IF THEN ELSE Your syntax seems (in theory) correct ``` CASE IF Op==1 THEN ...; END; IF Op==2 THEN ...; END; IF Op==3 THEN ...; END; END; ``` Note that you can use PRINT(pi*R^2); instead of PRINT(string(pi*R^2)); PRINT("Area = " + pi*R^2); is aloso correct. Not need of explicit 'string' conversion Edited: 19 Feb 2013, 2:26 a.m.

 Re: HP 39gii: CASE SyntaxMessage #4 Posted by Eddie W. Shore on 20 Feb 2013, 3:58 p.m.,in response to message #3 by Gilles Carpentier Quote: Hi Eddy, The CASE command dont work. It is a bug. I hope this to be corrected in the next ROM You must use imbricated IF THEN ELSE Your syntax seems (in theory) correct ``` CASE IF Op==1 THEN ...; END; IF Op==2 THEN ...; END; IF Op==3 THEN ...; END; END; ``` Note that you can use PRINT(pi*R^2); instead of PRINT(string(pi*R^2)); PRINT("Area = " + pi*R^2); is aloso correct. Not need of explicit 'string' conversion Thankfully multiple IF THEN END structures work. Thanks.

Go back to the main exhibit hall