Campbell CR800 Specifikace Strana 116

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 324
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 115
Section 5. Program Declarations
5-6
Sub, Exit Sub, End Sub
Declares the name, variables, and code that form a Subroutine.
Syntax
Sub SubName [(VariableList )]
[ statementblock ]
[ Exit Sub ]
[ statementblock ]
End Sub
The Sub statement has these parts:
Part Description
Sub Marks the beginning of a Subroutine.
SubName Name of the Subroutine. Subname cannot be the same as
any other globally recognized name in the program.
VariableList List of variables that are passed to the Subroutine when it
is called. The list of Subroutine variables to pass is
optional. Subroutines can operate on the global program
variables declared by the Public or Dim statements. The
advantage of passing variables is that the subroutine can
be used to operate on whatever program variable is passed
(see example).
If the Subroutine variable list is used, the variable names
used in this list should not be the same names as variables,
aliases, or constants declared elsewhere. Multiple
variables are separated by commas. When the Subroutine
is called, the call statement must list the program variables
or values to pass into the subroutine variable. The number
and sequence of the program variables/values in the call
statement must match the number and sequence of the
variable list in the sub declaration. Changing the value of
one of the variables in this list inside the Subroutine
changes the value of the variable passed into it in the
calling procedure.
The call may pass constants or expressions that evaluate to
constants (i.e., do not contain a variable) into some of the
variables. If a constant is passed, the “variable” it is
passed to becomes a constant and cannot be changed by
the subroutine. If constants will be passed, the subroutine
should be written to not try to change the value of the
“variables” they will be passed into.
statementblock Any group of statements that are executed within the body
of the Subroutine.
Zobrazit stránku 115
1 2 ... 111 112 113 114 115 116 117 118 119 120 121 ... 323 324

Komentáře k této Příručce

Žádné komentáře