Displaying code in my post

I had tried the backticks, but I was missing the new lines, that’s where I was going wrong. Thanks.