WordPress (poor) support for indented code segments

I was trying to reply to a comment on one of my own posts this evening and wanted to include some indented code snippets in the reply. I duly surrounded said snippets with the code tag (which is fairly standard practice in most blogs/forums I contribute to), only to find that the indentation was not displayed when the published reply was viewed in a browser.

I found the answer here in the form of the <pre> tag. This isn’t one of the available tags in the WordPress authoring panel but does the trick very nicely, as you will see from the samples below.

Here is an example of some indented code that uses the code tag:

public void getString()
{
if (null == str)
return "";
else
return str;
}

Here is the same code with the <pre> tag:

public void getString()
{
  if (null == str)
    return "";
  else
    return str;
}