Exit the current scope, which can be a function, script, or script block.
Syntax return return expression
In PowerShell, the result of each statement is returned as output, even without an explicit Return keyword.
So
$price
return
has exactly the same effect as:
return $price
Example
Add the number 5 and return the value:
function demoadd { param ($value) "Adding five" $value += 5 return $value } C:\PS> $result = demoadd 2
C:\PS> C:\PS> $result Adding five 7
The key point to note in the above example is that the "Adding 5" string is not displayed, but is instead assigned to the $result variable and returned along with the number.
“It hurts to love someone and not be loved in return, but what is the most painful is to love someone and never find the courage to let the person know how you feel” ~ Anon
Related PowerShell Cmdlets:
Break - Exit a program loop.
Continue - Skip just this iteration of a loop.
Exit-PSSession -
Exit PowerShell (or exit a script).