February 2019
Intermediate to advanced
626 pages
15h 51m
English
The type assigned to a parameter is written before the parameter name.
For example, if the function expects a string, the parameter type might be set to [String]:
param ( [String]$Parameter1)
Any value passed to the parameter will be converted into a string. Within the function, it is therefore possible to know that the value is of that particular type.
When assigning a type to a parameter, it is important to remember that the type persists until a new type is assigned, or the variable is destroyed. Therefore, values assigned to the parameter within a function will be cast to a string.
Read now
Unlock full access