First a basic solution followed by a fancy solution below.
I had originally designed this to have square brackets on both sides (which I have left, but just commented that portion). So \bracs was intended to be used when you have paragraphs, and \bracs* for things like tabular.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\usepackage{lipsum}
\NewDocumentCommand{\bracs}{s m}{%
\IfBooleanTF{#1}{%
\ensuremath{\left[\vphantom{\text{#2}}\right.}%
\text{#2}%
%\ensuremath{\left.\vphantom{\text{#2}}\right]}%
}{%
\ensuremath{\left[\vphantom{\parbox{0.95\linewidth}{#2}}\right.}%
\parbox{0.95\linewidth}{#2}%
%\ensuremath{\left.\vphantom{\parbox{0.95\linewidth}{#2}}\right]}%
}}%
\begin{document}
\bracs{
\begin{tabular}{l}
Get the height of the box hBox \\
Get the width of the box wBox \\
Get the length of the box lBox \\
vol = hBox * wBox * lBox\\
\bracs{
\begin{tabular}{l}
if vol $>$ 10
Display "Your box is too big"\\
else\\
Display "Your box is right-sized"\\
\end{tabular}
}
\end{tabular}
}
\bigskip
\bracs{\lipsum[1]}
\end{document}
As egreg mentions, tabular is the text mode environment so that is what is used here.

Update: You can also do this with the help of the mdframed package along with tikz to get fancy if you so desire:

I have added a frame using mdframed but disabled the top, right, and bottom frame, and used an tikz arrow style to produce the top portion of the bracket.
The \BracS macro here accepts an additional parameter to control the background color if you choose to (default is yellow!20). See the xcolor documentation for more options on colors.
There are a few obvious options here that you can tweak including the line color, and width. You can also change that each time if you so choose by passing in the entire tikzsetting line as in
\BracS[yellow!20,tikzsetting={draw=blue, line width=3pt,|-|}]
Note that the color must be the first specified parameter -- the order of any others will just take the last value for a particular option.
Here is the complete code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage[framemethod=tikz,xcolor=true]{mdframed}
\usepackage{lipsum}
\mdfdefinestyle{BracStyle}{%
leftmargin=2ex,%
topline=false,%
rightline=false,%
bottomline=false,%
backgroundcolor=yellow!20,%
tikzsetting={draw=red, line width=3pt,|-|},%
}%
\newcommand{\BracS}[2][yellow!20]{%
\begin{mdframed}[style=BracStyle,backgroundcolor=#1]%
{#2}%
\end{mdframed}%
}%
\begin{document}
\BracS{% default to yellow!20 background
\begin{tabular}{p{\linewidth}}
Get the height of the box hBox \\
Get the width of the box wBox \\
Get the length of the box lBox \\
vol = hBox * wBox * lBox\\
\BracS[blue!20]{
\begin{tabular}{p{\linewidth}}
if vol $>$ 10\\
Display "Your box is too big"\\
else\\
Display "Your box is right-sized"\\
\end{tabular}
}
\end{tabular}
}
\end{document}
\mbox{blah}as the overwhelming majority of the content will be text. – olivier Sep 30 '11 at 09:57\mboxes and parentheses to cut down the clutter. You may also want to look into the various algorithm/pseudocode environments, such asalgorithm2e.styorpseudocode.sty. – Niel de Beaudrap Sep 30 '11 at 10:19