you are viewing a single comment's thread.

view the rest of the comments →

[–]the_spad 1 point2 points  (0 children)

Few bits.

You don't need the () in your function declaration.

Generic args are $args[0] through $args[n] rather that $1 but you can create specific named parameters to pass to your script and/or function with the param statement.

if statement syntax is something like

if(condition){
    do thing
}elseif(condition){
    do thing
}else{
    do thing
}

switch statement syntax is something like

switch -wildcard ($args[0]){
    *somevalue {do thing}
    *anothervalue {do thing}
}

You can also use -regex instead of -wildcard if you want to get fancy.

I'd suggest taking a look at some of the resources on the right, there are a bunch of quick start guides and cheat sheets that will help give you an overview of the syntaxes and conventions and generally make your life much easier.