1 / 7

Document Procedure Relationship in OED

Document Procedure Relationship in OED. VB Nomenclature for Procedures. Procedures. Procedures perform a set of processes Defining procedures Private Sub ProcedureName(argument list with types) {body of procedure End Sub Calling procedures Call ProcedureName(arg1, arg2, …, argLast)

Download Presentation

Document Procedure Relationship in OED

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Document Procedure Relationship in OED

  2. VB Nomenclature for Procedures

  3. Procedures • Procedures perform a set of processes • Defining procedures • Private Sub ProcedureName(argument list with types) • {body of procedure • End Sub • Calling procedures • Call ProcedureName(arg1, arg2, …, argLast) • ProcedureName arg1, agr2, …, argLast • Arguments may be sent ByVal or ByRef • If not specified, ByRef is assumed

  4. Functions • Functions calculate and return a single value • Defining functions Private Function FcnName(arg list with types) As FcnType {body of function{at least one line should assign {value to FcnName{NOTE: if nothing is assigned to FcnName, {the default value of FcnType is returned End Function

  5. Functions • Calling functions • When the return value is used, the function name can appear anywhere an expression can appear variable = FcnName(arg1, arg2, …, argLast) • When the return value is discarded, a function may be called using the same syntax as for a procedure • Arguments may be sent ByVal or ByRef • If not specified, ByRef is assumed

  6. ByVal A copy of the argument is made. Pros Generally safer than passing by reference. Cons Generally less efficient because of all the memory copying. Doesn't do parameter type checking. ByRef Both procedures reference the same memory location. Pros. Is generally more efficient than pass by value. Does parameter type checking. Cons Not as programmer "safe" as pass by value. Argument Passing

  7. There is a syntactical difference between declaring or defining a function and a procedure. Both functions and procedures can accept multiple arguments ByVal or ByRef. Functions always return a value, but the value can be discarded. Functions exist for calling syntax reasons The manner by which they are commonly called serves as a reminder that they represent a single value (the result of the function) You can achieve the same result by using general procedures and returning the single result found through passing by reference – (but not generally desired). Procedures vs. Functions

More Related