A lawyer’s favourite answer: it depends.
Because it really does. It depends on how frequently you move; any less than a few years in a house and you will likely lose money on closing costs alone. It depends on how stable your income is; if you frequently would have to borrow from a credit line to make ends meet just to own a house, you’ll be paying far more for that house than you should be. It depends on where you live; in very hot housing markets like Toronto, it can make more sense to find an affordable rental than stretch beyond your means just to say that you own a home.
There are a lot of considerations that go into whether you should buy or rent. Don’t jump into a decision – always get as much professional advice as you can. And don’t be afraid to go with a choice that makes sense for you, even if it’s not what you’re “supposed” to do.