Go with whatever makes you feel comfortable. But also consider educating a bit yourself on the topic. Investing in the stock market is not (necessity) gambling and allows you to easily and greatly diversify your portfolio, while if you put all your eggs in the same basket you'll have a single point of failure.
Since you brought up inflation (not really a problem these days), in that sense it'd be better to have a mortgage since your debt will be worth less in the future than it is today.