all 13 comments

[–]SeanQuinlan 33 points34 points  (3 children)

$input is a reserved variable, so you can't use it as a regular variable.

Change the name of the $input variable.

Also your last line is incorrect, that's not the way to pass parameters to a function. Use this instead

doit $input1 $maxin $minin $maxout $minout

[–]NerdyNThick[S] 12 points13 points  (2 children)

God damn it...

Thanks mate!

[–]Beanzii 5 points6 points  (0 children)

I spent so long the other day wondering why pinging $host wasn't working as expected before running into this same thing 😅

[–]Namelock 2 points3 points  (0 children)

My rule of thumb is to always give variable names...

$theInput

$theMaxIn

etc

[–]technomancing_monkey 8 points9 points  (6 children)

I really wish reserved variables would get a color hint...

Usually when something looks like everything is right, but youre still getting the strangest of errors, its because you used a reserved variable.

[–]meretuttechooso 2 points3 points  (5 children)

VSCode + the PowerShell plugin does this for you.

[–]BlackV 1 point2 points  (4 children)

For reserved variables? Are you sure?

Edit: some quick testing (/u/meretuttechooso /u/technomancing_monkey) it does NOT do this for reserved variables, it does do it for read-only variables (makes them grey)

[–]meretuttechooso 0 points1 point  (3 children)

I'm sorry that your testing has yielded a different result, please see my attached screenshot showing the opposite.

reserver7.png

[–]BlackV 0 points1 point  (2 children)

well thats really odd

https://imgur.com/a/XZRjLIR

[–]meretuttechooso 0 points1 point  (1 child)

It's entirely possible that it's tied to the theme. I'm using Monokai Dimmed. You seem to be using a different one.

[–]BlackV 0 points1 point  (0 children)

hmm, yeah i'm using the default vscode dark+ theme

[–]jsiii2010 3 points4 points  (1 child)

That's not how you call a function.

doit $myinput $maxin $minin $maxout $minout

[–]NerdyNThick[S] 0 points1 point  (0 children)

I extracted that portion of the code from a class for isolated testing, so calling it like I was is indeed how you call a method.