Show
Python functionsA function is a group of statements that exist within a program for the purpose of performing a specific task. Instead of writing a large program as one long sequence of statements, it can be written as several small functions, each one performing a specific part of the task. A function is a reusable portion of a program, sometimes called a procedure or subroutine.
Why write and use functions?
With functions, there are 2 major points of view
Using functions
Building functions
Calling a function
Scope of Identifiers
Function parameters and using keyword return
What do we call a series of statements that performs a task?A Function procedure is a series of Visual Basic statements enclosed by the Function and End Function statements. The Function procedure performs a task and then returns control to the calling code.
Which of the following is a group of statements which are part of another statement?Compound statements contain (groups of) other statements; they affect or control the execution of those other statements in some way.
What statement do you have in a value returning function?To return a value from a function, you must include a return statement, followed by the value to be returned, before the function's end statement. If you do not include a return statement or if you do not specify a value after the keyword return, the value returned by the function is unpredictable.
What term is used to describe the portion of a program in which a variable can be accessed?Variable Scope. A variable's scope determines where in a program a variable is available for use. A variable's scope is defined by where the variable is initialized or created.
|