# Show or hide rows of a tabular controlled by a global variable

Is it possible to show or hide rows of a table by setting a global boolean variable?

\documentclass{minimal}

% some boolean variable X

\begin{document}

\begin{tabular}{ccc}
A & B & C \\
A & B & C \\
A & B & C \\ %show this row iff X is true
A & B & C \\
A & B & C \\ % show this row iff X is true
\end{tabular}

\end{document}

-
I don't think this is a dupe: the proposed question is about columns, while there it's rows that are important. The approaches needed are very different. –  Joseph Wright Dec 9 '11 at 10:13
@JosephWright If there is a similar question about columns, could you provide the link to it? –  student Dec 9 '11 at 10:18

etoolbox provides an easy syntax for this: \ifbool{FLAG}{IF-TRUE}{IF-FALSE}:

\documentclass{minimal}
\usepackage{etoolbox}

\newbool{extrarows}
\booltrue{extrarows}

\begin{document}

\begin{tabular}{ccc}
A & B & C \\
A & B & C \\
\ifbool{extrarows}{D & E & F \\}{}
A & B & C \\
\ifbool{extrarows}{D & E & F \\}{}
\end{tabular}

\end{document}

-