On Jan 20, 2010, at 3:41 PM, Emmett wrote:
> Could I please get a code snip using the constant _cr = 13
Emmett - constants are a good way to make code more readable
If I write:
_cr = 13
dim as Str31 s
s = "this is some text" + chr$( _cr )
It is easy to see a carriage return is being added to the end of the
string
If I'm looking at:
s = "this is some text" + chr$( 13 )
I might have to look up what an ASCII 13 is.
Another advantage is being able to change one constant to change its
many uses.
If I have:
_programmerName$ = "Emmett"
_city$ = "Denver"
print _programmerName$ + " lives in " + _city$
print "while " + _programmerName$ + " enjoys the weather in the
summer, " + _city$ + " is cold in the winter"
and then imagine 30 or 40 more such assignments and/or print
statements throughout the program.
If I want a different programmer name and city the only changes are
the the constants ( _programmerName$ and _city$ )
If those names were hard-coded ( i.e. without constants ) the
programmer would have to visit all 30 to 40 instances and change them.
Not only time-consuming but potentially error-prone.
HTH---
Brian S