lundi 28 juin 2021

Error when atempting to get a key press (A, B, or C) and storing their letter

I am trying to make an interactive Pythagorean Theorem calculator which shows some graphics and then waits for you to press the keys A, B, or C so you can enter their respective values for the calculation.

But I get the following error:
ERROR: DATA TYPE

It worked fine until I tried some If-else statements.
Here's my code:

ZStandard
84→Xmin
72→Ymax
ZInteger
FnOff 

{0,100,100,0}→L1
{0,60,0,0}→L2
Plot1(xyLine,L1,L2

Text(60,130,"C"
Text(90,250,"A"
Text(148,150,"B"

DispGraph

"N"→P
Repeat Ans≥41 and Ans≤43
getKey
If Ans=41
"A"→P
If Ans=42
"B"→P
If Ans=43
"C"→P
End

Disp P

I would like it to ignore any keys that aren't A, B, or C, but if they are any of those three, then save the letter to a variable P. So if I press A, which is 41, then P=41.

Aucun commentaire:

Enregistrer un commentaire