I have a script which takes these arguments:
param (
[parameter(Mandatory=$true)][ValidateRange(1, [int]::MaxValue)]
[Int]$startRevision,
[parameter(Mandatory=$true)][ValidateRange(1, [int]::MaxValue)]
[Int]$endRevision,
[parameter(Mandatory=$false)][ValidateRange(1, [int]::MaxValue)]
[Int]$stepSize = 10,
[parameter(Mandatory=$false)]
[String]$applicationToBuild
)
Since the last argument is optional, I would like to know if the argument is set. Is there any way to do this?
A default is not ok, since I don't want to use the variable if it is not set. I could use a default which is a "ThisIsNotSet" and check if the value is equal to this string, but is there a better solution?