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.

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.

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. *

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.