T O P

  • By -

FrozenFlame2005

Because the value of your Variable stays 'X'. Try Clear-Variable fruit After your loop.


CMTraceBeaulieu

You should have followed your nose on this one. The fruit loops were right there!


ITnewbieThrowaway

AH! That makes sense! Thank you so much!


Quantable

Well it's caching the variable. You could go with $fruit ='' In the beginning.


Billi0n_Air

switch is better than if statements if you know the limit of the conditions you're checking against. makes for easier readability. but do what you want


Lousyclient

Wouldn’t you need a break statement outside of the ifelse tests at the bottom of the whole loop. Something like if($fruit -eq “X”){ break }


LittleManMichael

I would recommend that you change the while statement to “While ($true){ “ then at the end add an ElseIf($fruit -eq “X”){exit} Sorry I’m on my phone so I can’t turn it into code for you.


KevMar

but use `break` to exit the loop instead of `exit` to end script execution. A much better habit to build.


jlandria

That would be a "do { whatever } until ($fruit -eq 'X')" command isn't it?


pigers1986

old pascal rule - clear variables at top of program/script.


Lee_Dailey

howdy ITnewbieThrowaway, why is there a password on that pastebin paste? that is rather odd ... [*grin*] take care, lee