 HP 39gii: CASE Syntax - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: HP 39gii: CASE Syntax (/thread-239316.html) HP 39gii: CASE Syntax - Eddie W. Shore - 02-18-2013 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 Syntax - Thomas Radtke - 02-19-2013 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 Syntax - Gilles Carpentier - 02-19-2013 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 Syntax - Eddie W. Shore - 02-20-2013 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.