• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

11. Functions and Subroutines > 11.3. Parameters and Arguments

Parameters and Arguments

Consider the following very simple subroutine, which does nothing more than display a message box declaring a person’s name:

Sub DisplayName(sName As String)
   MsgBox "My name is " & sName
End Sub

To call this subroutine, we would write, for example:

DisplayName "Wolfgang"

or:

Call DisplayName("Wolfgang")

The variable sName in the procedure declaration:

Sub DisplayName(sName As String)

is called a parameter of the procedure. The call to the procedure should contain a string variable or a literal string that is represented by the variable sName in this procedure (but see the discussion of optional arguments in the next section). The value used in place of the parameter when we make the procedure call is called an argument . Thus, in the previous example, the argument is the string “Wolfgang.”


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint