For most of my codes in post posts I use the “Preformatted” style from the drop down menu in the Visual editor of WordPress. It works quite well for demonstrating sections of code or screen output. However, there is a problem with using Preformatted and that is the issue with word wrapping.
Preformatted style in WordPress uses the <pre> HTML tag. The <pre> tag does not word wrap any of the sentences contained within, and if you are using a defined space for displaying the text, as with the theme on my WordPress, you may find that your examples are shortened and the text appears over the sidebar or scroll bar appears. There is a fix to this problem that requires some minor style tag modifications for the <pre> tags that seem to run off into the distance.