If you are temporarily staying in a place for a relatively short time in a particular location, it is wise for you to rent out space instead of buying. Buying can be costly for you in this situation, but if you can afford it, it is recommended that you purchase anyway because when you leave the place, you can sell it for a more significant price or let it for passive income.
If you are planning to settle down on a place, you have to secure your property and buy a house. A more permanent residency can be disturbed if you are renting a space, and the landlord changes his property’s priority and has to evict you.
A good gauge is that if you are seeing a long-term relationship with a company you are working at, own a space where it is based.