The following block describes a syntax for a function:

function [<scope:>]<name> [([type]$parameter1[,[type]$parameter2])]
{
param([type]$parameter1 [,[type]$parameter2])
dynamicparam {<statement list>}
begin {<statement list>}
process {<statement list>}
end {<statement list>}
}
The above syntax includes the following terms:
- A function keyword
- A name which is given by you
- A scope (It is optional)
- Any number of named parameter
- One or more commands of PowerShell which are enclosed in braces {}.
Leave a Reply