Are there any ways to do control flow depending on the compilation method?

I would like to do something like

``````\if{\pdflatex}{
\includepdf{file.pdf}
}

\if{\latex}{
\epsfig{file.eps}
}
``````

Maybe this isn't the best example, but do control-flow solutions exist in LaTeX to let us do something depending on how we compile?

-
Although for your specific example of wanting to include graphics.eps or graphics.pdf it's better to `\usepackage{graphicx}` and not specify an extension, i.e. `\includegraphics{graphics}`. See this FAQ answer.