CIS: Chp 6
3 things a procedure or function do?
They help to break up a large body of code into smaller chunks 2. They make it easier to maintain and modify code 3. They permit the same sequence of code statements to be called from multiple places
A function can only return a single value (T/F)
True
A function is a self-contained set of statements that can receive input values (T/F)
True
A function must contain at least one Return statement. (T/F)
True
When declaring a procedure, the default accessibility specifier is Public. (T/F)
True
You can use a function to call in an expression. (T/F)
True
a function's signature contains what?
a name, a list of parameters, and return type
a value passed to a procedure
argument
exist only as long as the block executes
block scope
variables declared inside blocks and can be used only inside that block
block scope
the original argument can be changed
by reference
temporary copy of the original argument
by value
statement that invokes a Sub procedure
calling statement
variables declared globally but outside any procedure and can be used by an procedure on form
class scope
last as long as the form is loaded
class scope variables (for a form)
A procedure ___________ return a value; a function ____________ return a value
does not; does
refers to how long (or when) the variable exists during processing; works in conjunction
duration
a type of procedure automatically executed when event occurs
event handler
examples of procedures
event handlers
a collection of statements that performs a task and then returns a value to the part of the program that executed it
function
triggered by statements in other procedures, not by events
general purpose procedures
what can you pass as arguments?
literals variables and any other expressions as long as the data types match the formal parameter declarations
procedure scope & can only be used inside that procedure
local variables and formal parameters
can only be used within the loop for which they are declared
loop counter variables
declared in the FOR statement exist throughout all repititions of the loop, and then disappear
loop counter variables
can be either a procedure or function
method
a special variable that receives a value being passed into a procedure
parameter
capitalize 1st character of name and each word
pascal case
a collection of statements that performs a task
procedure
usually exist only as long as the procedure executes
procedure scope
a variable's ______ is its visibility
scope
continue to debug by single-stepping through a procedure
the Step Into
end single-stepping in procedure, continue single-step after the call
the Step Out command
run procedure without single-stepping, continue single-step after the calling
the Step Over command
When calling a procedure, passed arguments and declared parameters must agree in what ways
the number of arguments and the number of parameters must be the same 2. the order of arguments and parameters must correspond 3.the types of the arguments and parameters must correspond
Usually, the statement that invokes a function will assign the function's return value to a(n)
variable
What can be determined by a function?
Boolean values, string values, and integer values
To allow an argument to be changed by the receiving procedure, pass the argument:
ByRef
examples of functions
CInt and IsNumeric
A function can return one more values. (T/F)
False
An event procedure is a Function procedure that is associated with a specific object and event. (t/f)
False
Dim is valid when declaring parameters. (T/F)
False
Functions will always return numeric values since strings and boolean values cannot be returned. (T/F)
False
The same function can return several data types including integer, string, or double (T/F)
False
Passing an argument by value means that:
Only a copy of the argument is passed to the procedure
An independent Sub procedure can contain one or more _______ in its procedure header that have procedure scope and store an item of data.
Parameters
enables selection of all text within the control
SelectAll() Method