Hey there guys, I just wrote up a thing that I was doing for an AD User creation script and thought I'd share with the class. I'm still in my first year of PowerShell, so I was pretty proud of what I found and how I fixed it. 🙂
Winding up doing string concatenation when you meant to do math (via the + or * operators) is definitely a common gotcha. As you pointed out, assigning types to your parameters is almost always the right thing to do. (And if you don't, expect to have to write some validation or conversion code before you actually do anything with what was passed in by the caller!)
As a best practice, you should always type your parameter variables, to help avoid that specific situation with the + operator. It's actually a bit more complex than what you ran into, but really, really vexing.
Thanks for sharing! If you'd like to write it up for the Gotchas book, we'd be happy to add it.