Reputation: 11
EDIT: Full code has been included, because it seems possible that the error may lie in the Else or End commands that are also part of the If-Then conditional.
Programming newbie here. I did see the many other if-else syntax error questions but seeing them, was worried that they did not address exactly whatever problem is going on in my case.
I have the following lines of commands on a TI-84 program I'm making.
Lbl 0 is just a label these lines of programming go to after all triangle values are calculated. It then calculates certain other values of this triangle based off of all of the angles & sides.
Lbl 2
Disp "Side A, Side B, Angle A"
Pause
Prompt A,B,D
sin(B*sin(D)/A)→E
If ((180-E+D)<180)
Then
Disp "Case 1"
Pause
180-D-E→F
A*sin(F)/sin(D)→C
Disp "Angle B=",E
Disp "Angle C=",F
Disp "Side C=",C
(A+B+C)/2→S
√(S(S-A)(S-B)(S-C))→H
Disp "Area=",H
Pause
Disp "Case 2"
Pause
180-E→E
180-D-E→F
A*sin(F)/sin(D)→C
(A+B+C)/2→S
√(S(S-A)(S-B)(S-C))→H
Disp "Angle B=",E
Disp "Angle C=",F
Disp "Side C=",C
Pause
Disp "Area=",H
Goto 0
Else
180-D-E→F
A*sin(F)/sin(D)→C
Disp "Angle B=",E
Disp "Angle C=",F
Disp "Side C=",C
Pause
Goto 0
End
The square is just an inverse (^-1) sign. It formats correctly in the TI Connect CE software that I'm using.
I assumed that the If-then lines were the problem lines, because removing them removes the SYNTAX error. Another possibility is that I set up my Else And End incorrectly, though I did consult the TI-Basic Developer Wiki and my setup seemed to be right.
What is wrong with the syntax of the If-then lines that is causing this error?
Upvotes: 1
Views: 786
Reputation: 984
I did not see any problems when I tried this on my calculator. The only thing that I thought could have been an error was the parenthesis around the if argument...
If ((180-E+D)<180)
vs
If 180-E+D<180
The program worked for me, so I can't identify a problem...
If you get the error and choose Goto, what line of the code does the calculator say the error is on?
Upvotes: 1