about_Return.help

about_Return.help - TOPIC about_Return SHORT DESCRIPTION...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 TOPIC about_Return SHORT DESCRIPTION Exits the current scope, which can be a function, script, or script block. LONG DESCRIPTION The Return keyword exits a function, script, or script block. It can be used to exit a scope at a specific point, to return a value, or to indicate that the end of the scope has been reached. Users who are familiar with languages like C or C# might want to use the Return keyword to make the logic of leaving a scope explicit. In Windows PowerShell, the results of each statement are returned as output, even without a statement that contains the Return keyword. Languages like C or C# return only the value or values that are specified by the Return keyword. Syntax The syntax for the Return keyword is as follows: return [<expression>] The Return keyword can appear alone, or it can be followed by a value or expression, as follows: return return $a return (2 + $a) Examples The following example uses the Return keyword to exit a function at a specific point if a conditional is met:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2010 for the course BUS fin taught by Professor Fez during the Spring '10 term at Valparaiso.

Page1 / 3

about_Return.help - TOPIC about_Return SHORT DESCRIPTION...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online