r/PowerShell • • Sep 17 '20

PowerShell vs Python Reference

https://blog.ironmansoftware.com/powershell-vs-python/
206 Upvotes

51 comments sorted by

View all comments

11

u/[deleted] Sep 17 '20 edited Oct 09 '20

I've been using PowerShell extensively since 2014 and I had no idea you could declare your arguments in the function definition's opening parentheses. I always did it like:

function ass
{
    param
    (
        $has_donk = $true
    )
}

Even if this is better practice I'm just shocked I didn't know you could do it the "traditional" way.

0

u/[deleted] Sep 17 '20

[deleted]

6

u/[deleted] Sep 17 '20

Yeah, it's odd that you can define the function that way, but not call it. If I had a background in other programming languages before picking up PS that would have confused the hell out of me.

3

u/TheIncorrigible1 Sep 17 '20

And it does confuse plenty of newcomers every day. There are countless SO duplicates for this "problem"