After this code executes, the value of
I
is 3.
If a routine's declaration specifies a var parameter, you must pass an assignable expression - that is, a variable,
typed constant (in the
{$J+}
state), dereferenced pointer, field, or indexed variableto the routine when you call it.
To use our previous examples,
DoubleByRef(7)
produces an error, although
DoubleByValue(7)
is legal.
Indexes and pointer dereferences passed in var parameters - for example,
DoubleByRef(MyArray[I])
- are
evaluated once, before execution of the routine.
Dostları ilə paylaş: