HP 39gii: CASE Syntax
#1

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.

#2

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.

#3

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.

#4

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.



Possibly Related Threads…
Thread Author Replies Views Last Post
  Gathering USB dumps for Connectivity Kit <-> 39gII communication... debrouxl 2 1,630 12-01-2013, 12:59 PM
Last Post: Marcus von Cube, Germany
  New firmware for HP 39gII Mic 6 2,776 11-26-2013, 06:23 PM
Last Post: DeboT
  HP Prime Tutorial #4 is up (CASE/CHOOSE/INPUT) Eddie W. Shore 1 1,278 11-15-2013, 07:32 AM
Last Post: Davi Ribeiro de Oliveira
  hp prime - command syntax bluesun08 6 2,337 11-10-2013, 11:57 AM
Last Post: bluesun08
  Leather case for the HP-Prime Karl-Ludwig Butte 9 3,841 10-19-2013, 06:08 PM
Last Post: Eddie W. Shore
  HP Prime vs. 39gII Connectivity Kit Marcus von Cube, Germany 3 1,700 10-09-2013, 05:44 PM
Last Post: Marcus von Cube, Germany
  [HP 39Gii] - Bug report Jean-Michel 1 1,590 08-28-2013, 10:53 AM
Last Post: Tim Wessman
  Input syntax on the Prime Gilles Carpentier 6 2,122 08-23-2013, 04:31 AM
Last Post: Gilles Carpentier
  hp 39gii lcd clear question giancarlo 7 2,639 08-18-2013, 07:30 AM
Last Post: Mic
  integration on 39gII emulator Wes Loewer 29 6,775 06-07-2013, 05:58 PM
Last Post: Chris Smith

Forum Jump: