How NOT to Code

By angros47

 

 

 

arg=Trim(arg)
If Instr("0123456789+-.(",Left(Arg,1)) Then
If Instr(Arg,".") Then Return 2 Else Return 1
End If
1 If Left(Arg,1)=Chr$(34) Then Return 3
If Instr(Arg," ") Then arg=Left(arg,Instr(arg," "))
For var.variable=Each variable
If Upper(Trim(var\name))=Upper(Trim(arg)) Then Return var\optype
Next

(can you see the “1” at a first glance?)

An even better solution is to use line labels, disguising them as subs:

if a=1 then test
print “a is not 1”
test: print “a=1”

also, if you have a sub called “test_1” or so, the trick works better.

 

sub Menu
print “1: Item 1”
print “2: Item 2”
print “3: Item 3”
print 
input “enter your choice”,a
if a <1 or a >3 then Menu
end sub

In LOGO it works perfectly, so it has to work in basic too, right?

 

 

 

 

 

 

For I=0 to 640
 X(i)=SIN(I/10)*10
NEXT
For I=0 to 640
 PSET (I,X(i))
NEXT

You could do:

For I=0 to 640
 X$(i)=STR$(SIN(I/10)*10)
NEXT
For I=0 to 640
  PSET (I, VAL(X$(i)))
NEXT