You don’t need semicolons in multi-line hashtable literals.

This is not a world-changing topic, but I thought it was worth sharing.

If you have written hashtable literals on a single line, you’ve seen this before:

$hash=@{Name='Mike';Blog='powershellstation-a07ac6.ingress-erytho.easywp.com'}

Sometimes, it makes more sense to write the hashtable over several lines, especially if it has several items. I’ve always written them like this:

$hash=@{Name='Mike';
        Blog='powershellstation-a07ac6.ingress-erytho.easywp.com';
        Language='PowerShell'
}

I was watching Don Jones’ toolmaking sessions on youtube and what he did was slightly different.

$hash=@{Name='Mike'
        Blog='powershellstation-a07ac6.ingress-erytho.easywp.com'
        Language='PowerShell'
}

I watched and waited for him to get errors, but he’s Don, so he got it right.

I’m not sure how I missed this, but you don’t need semicolons in multi-line hashtable literals.

–Mike