Posted By
SVS on 2006-09-01 10:03:37
| BASIC tricks
I would to insert in next release of UltimateMap, a new section with all known CBM BASIC tricks. Of course it depends by the feedbacks on this post... then please send a post with yours!
These are the first ones: 1) IF xxx THEN GOTO yyy --> IF xxx THEN yyy 2) IF var<>0 THEN xxx --> IF var THEN xxx 3) GOTO 0 --> GOTO
|
|
Posted By
JamesD on 2006-09-01 10:41:04
| Re: BASIC tricks
Those are pretty standard to most versions of BASIC. There might be a few dialects that don't support them but I haven't used one.
|
|
Posted By
JamesD on 2006-09-01 10:42:11
| Re: BASIC tricks
Well, except for GOTO 0
|
|
Posted By
Csabo on 2006-09-01 19:26:53
| Re: BASIC tricks
4) var=0 --> var=. (faster) 5) var=0.5 --> var=.5 (faster, takes less space)
|
|
Posted By
SVS on 2006-09-03 07:41:32
| Re: BASIC tricks
Another one:
NEXT I,J --> NEXT: NEXT (faster)
|
|
Posted By
Csabo on 2006-09-03 09:17:07
| Re: BASIC tricks
That's a good one, also takes one less byte
|
|
Posted By
Chicken on 2006-09-07 10:36:28
| Re: BASIC tricks
I think it's a good idea to include anything clever... not just limited to the CBM flavors of BASIC, as long as it works in BASIC 3.5 Some tricks might be obvious to experienced programmer's but maybe there's someone out there who didn't know
Sometimes you need variable alternating between 0 and 1 (e.g. some kind of action taking place every other round)
var=1: rem init
var=1-var: rem inside the loop
|
|
Posted By
Litwr on 2006-09-12 09:25:22
| Re: BASIC tricks
PRINT (1<2)+(1>2)+1 0!
|
|
Posted By
Paco on 2006-09-14 11:13:45
| Re: BASIC tricks
IF A<=>B THEN PRINT "ALWAYS TRUE"
|
|
Posted By
SVS on 2006-09-14 11:46:52
| Re: BASIC tricks
this comes from Spiro T.: IF xxx THEN GOTO yyy --> IF xxx GOTO yyy
Now mine:
SYS 12345plus4 (works with any number, and any string)
GOTO xxxx: here you can put any comment (without REM)
|
|
Posted By
JamesD on 2006-09-14 13:22:07
| Re: BASIC tricks
> GOTO xxxx: here you can put any comment > (without REM)
Not only does it let you put any comment there but it should also tokenize any key words in your comment
|
|
Posted By
SVS on 2006-10-11 09:59:07
| Re: BASIC tricks
PRINT VAL("E40") ?OVERFLOW ERROR
(even if this one is explainable by math evaluation routine)
|
|
Posted By
SVS on 2006-10-12 06:04:02
| Re: BASIC tricks
Oops! I would say: VAL("E100")
|
|