In response to this question I thought the obvious thing to do was the following:
\documentclass{article}
\newif\iffoo
\newenvironment{foobar}{\iffoo}{\fi}
\begin{document}
\begin{foobar}
Here is text
\end{foobar}
Here is more text
\end{document}
This doesn't work: ! Incomplete \iffalse; all text was ignored after line 5.
If, however, I add a \footrue to the preamble it compiles fine. Adding \foofalse does not make it work.
Could someone explain this behaviour? This sort of thing is possible: the comment package does exactly this. I am not asking how to achieve this behaviour. My question is: why doesn't this thing work in LaTeX "out of the box"?