It??™s good programming practice to
prepare for as many different situations as can be imagined.
Also good practice is the use of spaces, indentations, and remarks to make
the code easier to read without affecting the execution of the script. The Rem
command is used to include remarks (comments that are ignored when the
script is run), allowing you to label any part of the script with pertinent
information. In place of the Rem command, you can also use a single apostrophe
( '), which??”unlike Rem??”can be placed on the same line as another
command, like this:
MsgBox TotalLumps 'display the result
As you write these scripts, think about the formatting as you would in writing
a word-processor document; scripts that are easier to read are easier to
debug and much more pleasant to revisit six months later.
Make Building Blocks with Subroutines and Functions
A subroutine allows you to encapsulate a bit of code inside a single command,
making it easy to repeat that command as many different times as
you want as though it were a built-in command. Simply include the entire
subroutine anywhere in a script, and then type the name of the subroutine
elsewhere in the script to execute the subroutine.
* In traditional algebra, you couldn??™t have a statement like this; it would be like saying x=x+1,
which has no solution. However, this is not an equation; it??™s an instruction that you want carried
out. Besides, you??™re supposed to have forgotten algebra years ago.
Pages:
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724