Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Question

Write a Powershell Script to get this output ?

1 is not even

4 3 is not even

8 5 is not even

12 7 is not even

16 9 is not even

20

Answer

Examples

The following example uses the return keyword to exit a function at a specific point if a conditional is met. Odd numbers are not multiplied because the return statement exits before that statement can execute.

function MultiplyEven
{ param($number) if ($number % 2) { return "$number is not even" } $number * 2
} 1..10 | ForEach-Object {MultiplyEven -Number $_}
1 is not even
4
3 is not even
8
5 is not even
12
7 is not even
16
9 is not even
20

Question

Write a Powershell Script to get this output ?

1 is not even

4 3 is not even

8 5 is not even

12 7 is not even

16 9 is not even

20

Answer
?

Question

Write a Powershell Script to get this output ?

1 is not even

4 3 is not even

8 5 is not even

12 7 is not even

16 9 is not even

20

Answer

Examples

The following example uses the return keyword to exit a function at a specific point if a conditional is met. Odd numbers are not multiplied because the return statement exits before that statement can execute.

function MultiplyEven
{ param($number) if ($number % 2) { return "$number is not even" } $number * 2
} 1..10 | ForEach-Object {MultiplyEven -Number $_}
1 is not even
4
3 is not even
8
5 is not even
12
7 is not even
16
9 is not even
20
If you want to change selection, open document below and click on "Move attachment"

about_Return | Microsoft Docs
r 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) <span>Examples The following example uses the return keyword to exit a function at a specific point if a conditional is met. Odd numbers are not multiplied because the return statement exits before that statement can execute. function MultiplyEven { param($number) if ($number % 2) { return "$number is not even" } $number * 2 } 1..10 | ForEach-Object {MultiplyEven -Number $_} 1 is not even 4 3 is not even 8 5 is not even 12 7 is not even 16 9 is not even 20 In PowerShell, values can be returned even if the return keyword is not used. The results of each statement are returned. For example, the following statements return the value of the $

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.