A - a-b vbasic and visual basic tips, A-b vbasic and visual basic tips – Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual
Page 47

A–B
A
Appendix
A–1
A-B VBASIC and Visual BASIC Tips
Misspellings
Don’t misspell names. BASIC is unforgiving of such errors since it will just
create a new variable which is zero or blank.
Strings in TYPEs
Strings which are defined in TYPE statements are of a fixed length. These
are always blank padded on the end.
Variables Beginning with “FN”
Do not start any variable name with FN, Fn, Fn, or fn. BASIC treats these as
a reference to the archaic DEF FN.... mechanism and produces a syntax error.
Accidental Omission of %, &, ! # OR $
If you leave the trailing character off of variable names, you will usually get
no warning from BASIC. Instead, the variable will be a different one than
what you expected. Watch out for this! If you happened to pick a
String/Integer mismatch, you will get syntax errors. Integer/Real mismatches
are very difficult to locate.
Another peculiarity of trailing characters is that if you have a function named
XYZ!, and you attempt to reference that function as XYZ# or XYZ% or
anything other than XYZ! or XYZ then you will get a MULTIPLE
DEFINITION error at the function declaration even though the reference is
many lines later.
Use of Colons as Statement Separators
Use of colon “:” as a statement separator can cause a number of problems
with both Visual BASIC and A-B VBASIC. An example follows:
CL2 : PRINT “This is a test” ;