![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | What echo has do with Return value? #In this script I call function what has echos in it and another witch does not have echos. Both should return value $false = False [int]0 or something like that?! function tester { echo "I return this and:" return $false } function testerNoEcho { return $false } $testing2 = (tester) 'Tests:' '1' echo $testing2 '2' echo ("($testing2)") '3' echo "($testing2)" '4' echo ($testing2) '5' echo "$testing2" '6' If ($testing2 -eq $false) { echo "YAY it worked!" } else { echo "oups, what happened?" } $testing2 = (testerNoEcho) 'Tests:' '1' echo $testing2 '2' echo ("($testing2)") '3' echo "($testing2)" '4' echo ($testing2) '5' echo "$testing2" '6' If ($testing2 -eq $false) { echo "YAY it worked!" } else { echo "oups, what happened?" } #This script outputs: Tests: 1 I return this and: False 2 (I return this and: False) 3 (I return this and: False) 4 I return this and: False 5 I return this and: False 6 oups, what happened? Tests: 1 False 2 (False) 3 (False) 4 False 5 False 6 YAY it worked! #Why does it return THE return value AND echos from function #It is supposed to return THE return value right? #Or how I can get function return value without getting all echos messing it up |
| | #2 (permalink) |
| Guest | Re: What echo has do with Return value? echo is an alias for write-output. Write-Output writes objects to the success pipeline. Try using write-host instead. PS ps:\> get-help write-output PS ps:\> get-help write-host gaurhoth "I really want to know" <I really want to know@discussions.microsoft.com> wrote in message news:0F3A6E14-D87F-4225-B5D3-860772B34A60@microsoft.com... > #In this script I call function what has echos in it and another witch does > not have echos. Both should return value $false = False [int]0 or something > like that?! > > function tester > { > echo "I return this and:" > return $false > } > > function testerNoEcho > { > return $false > } > > $testing2 = (tester) > > 'Tests:' > > '1' > echo $testing2 > '2' > echo ("($testing2)") > '3' > echo "($testing2)" > '4' > echo ($testing2) > '5' > echo "$testing2" > '6' > > > If ($testing2 -eq $false) > { > echo "YAY it worked!" > } > else > { > echo "oups, what happened?" > } > > > $testing2 = (testerNoEcho) > > 'Tests:' > > '1' > echo $testing2 > '2' > echo ("($testing2)") > '3' > echo "($testing2)" > '4' > echo ($testing2) > '5' > echo "$testing2" > '6' > > > > If ($testing2 -eq $false) > { > echo "YAY it worked!" > } > else > { > echo "oups, what happened?" > } > > > #This script outputs: > > Tests: > 1 > I return this and: > False > 2 > (I return this and: False) > 3 > (I return this and: False) > 4 > I return this and: > False > 5 > I return this and: False > 6 > oups, what happened? > Tests: > 1 > False > 2 > (False) > 3 > (False) > 4 > False > 5 > False > 6 > YAY it worked! > > > #Why does it return THE return value AND echos from function > #It is supposed to return THE return value right? > #Or how I can get function return value without getting all echos messing it > up |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WScript.Echo | PaulM | VB Script | 3 | 07-18-2008 02:33 AM |
| Miccrophone echo | Joanne | Vista hardware & devices | 2 | 06-07-2008 09:26 AM |
| echo cancellation | gram | Vista General | 0 | 11-14-2007 12:05 PM |
| echo output | Jens Diekers | PowerShell | 2 | 08-13-2007 09:07 AM |
| Any Way To Get Rid Of The Echo? | Arny Krueger | Vista music pictures video | 1 | 11-22-2006 10:03 AM |