Basic and Machine Language
Moderator: Moderators
Jeff-20
Denial Founder
Posts: 5761 Joined: Wed Dec 31, 1969 6:00 pm
Post
by Jeff-20 » Fri Feb 13, 2004 7:28 pm
Look at this line. Can you see why it produces a SYNTAX ERROR?
10 FOR T=1 TO 15: PRINT T AND 3: NEXT
Look closely. The problem is quite simple. Typed without spaces (as we all do), the computer wants to read "T AND 3" as "TAN D3".
Tan is a basic token, and without a parenthetical following, the computer assumes it is a mistake. THe problem is easily fixed by replacing the variable T.
aneurysm
not your PAL
Posts: 178 Joined: Sat Mar 06, 2004 11:06 pm
Post
by aneurysm » Sat Mar 06, 2004 11:17 pm
woah
GreyGhost
Vic 20 Nerd
Posts: 526 Joined: Wed Oct 05, 2005 11:10 pm
Post
by GreyGhost » Sat Feb 11, 2006 10:51 am
I got caught up with this one for five minutes:
10 INPUT "{CLR}FILE NAME:";FN$
So simple, yet so frustrating.
Rob
Jeff-20
Denial Founder
Posts: 5761 Joined: Wed Dec 31, 1969 6:00 pm
Post
by Jeff-20 » Sat Feb 11, 2006 12:28 pm
DEF FN? (I'm not sure. . .)
Tepic
Vic 20 Devotee
Posts: 209 Joined: Wed Mar 24, 2004 10:47 pm
Post
by Tepic » Sat Feb 11, 2006 12:32 pm
I think the FN part.
A=FNB(2) etc
Schema
factor
Posts: 1430 Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario
Post
by Schema » Sat Feb 11, 2006 3:46 pm
Jim Butterfield did a hilarious talk on this at World of Commodore last year. You can also type
10 FOR T=1 TO 15: PRINTT{graphics character}AND3: NEXT
BASIC will remove the graphics character and the line will look OK. But if you hit Return on the line again, you get the error.
carlsson
Class of '6502
Posts: 5516 Joined: Wed Mar 10, 2004 1:41 am
Post
by carlsson » Sat Feb 11, 2006 6:04 pm
Or for that matter TA{SHIFT+N}3. The parser will look up rather than expand the abbreviation before inserting the right token.
SYS53387E$ was solved as SYS(53387)E$. In similar fashion, PRINT(T)AND3 would also be a solution here.