Chapter 14. Procedures, Functions, and Blocks
Beginner
Q: | ||||||||||||||||
14-1. | A procedure executes one or more statements and then terminates. A function executes one or more statements and then returns a result via the RETURN statement. | |||||||||||||||
Q: | ||||||||||||||||
14-2. | Procedures and functions are composed of the following four sections:
| |||||||||||||||
Q: | ||||||||||||||||
14-3. | Use the RETURN statement to return a value from a function. It has the following format: RETURN where expression is a literal, variable, or complex expression whose datatype matches (or can be converted to) the datatype in the function’s header’s RETURN clause. You can use RETURN inside a procedure, but you may not specify data to be returned. Instead you simply state: RETURN; The procedure immediately terminates and returns control to the enclosing block. You should avoid using RETURN in a procedure, however, because it leads to unstructured code that is hard to read ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access