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]

4

u/Thotaz Sep 17 '20

never cmdlet(a, b)

Actually, you can do that: Get-ChildItem("C:\") works just fine.

8

u/le_luka Sep 17 '20

As Long as there is only one argument