Code:
Code: prgm:PHYSICS
:Disp "Solve for:"
:Disp "Cosine Law (0)"
:Disp "Something Else (1)"
:Input Z
:If Z=0
:Then
:Disp "Zero"
:Else
:Disp "Not Zero"
:End
:prgmPHYSICS
Whenever executed an ERR:SYNTAX occurs, specifically at ":Then".
The compiled program. For TI84+ SE (if it matters).
If anybody could tell me what I'm doing wrong, you would have my sincerest gratitude. Thanks in Advance!
Should not matter but try
Code:
If not(Z
I can't view the .8xp right now since I'm posting from my phone, but are you sure that those are actual tokens, not just text? For example, Input wouldn't be typed into your calculator as 2nd-ALPHA-I-N-P-U-T, you would type it as PRGM-Right-1.
With that above code, nothing is wrong and it works alright. Check your code on your calc and see if you mistyped anything.
If I'm not mistaken, he seems to have put a colon on every line. Of course, that's what I see in an emulator, so it might not be the case.
^What he said. Out of curiosity, run your program through SourceCoder, and see how many Then/Else/Ends it says you have.
Aes_Sedia5 wrote:
Should not matter but try
Code:
If not(Z
Tried, but to no avail.
@souvik1997
They are definitely tokens.
@seana11
I think you solved it!
Oh, that's right. A silly TI-OS bug is that a line that consists only of an additional colon and a "Then" is considered a syntax error.
Seana: Well yes, every line of a TI-BASIC program starts with a colon. Linyx, any luck with SourceCoder's structure counter?
Kerm, I think he put an extra colon between the If and the Then, which caused the error.
souvik1997 wrote:
Kerm, I think he put an extra colon between the If and the Then, which caused the error.
Oh, then I guess whatever editor he copied that from doesn't show the colons that the editor itself show.
KermMartian wrote:
Seana: Well yes, every line of a TI-BASIC program starts with a colon. Linyx, any luck with SourceCoder's structure counter?
They sure do, but something was automatically adding them, so I had two on each line. Which begs the question of why didn't it crash before the "Then"? (Nevermind, I see what Seana means, I think).
Yes sir, it's amazing and showed me the same thing Seana pointed out. I'm going to give it a try for a full program now.
Thanks a million to everyone for the help!
KermMartian wrote:
Seana: Well yes, every line of a TI-BASIC program starts with a colon. Linyx, any luck with SourceCoder's structure counter?
No, he has two colons. nvm.
seana11 wrote:
KermMartian wrote:
Seana: Well yes, every line of a TI-BASIC program starts with a colon. Linyx, any luck with SourceCoder's structure counter?
No, he has two colons. nvm. Indeed, I get that now; it's just that I'm used to looking at source code that shows the line-beginning colons anyway, so the fact that those were all literal typed colons confused me.
That can actually be quite the problem when transferring between SourceCoder and, say, TokenIDE. If you copy the code straight from SourceCoder, it'll have those colons, and TokenIDE will tokenize then, as is its wont. Which makes sense, right? The calculator shows the colons for convenience, when you're on the computer there's really no need for them. I should add a "paste from SourceCoder" feature that removes the colons.