There are many ways to do this. Here is one using a single, primitive \if (since you only have two courses):
Course: math
Teacher: Bill
\documentclass{article}
\newcommand{\course}{%
\ifmathcourse
math%
\else% not mathcourse
physics%
\fi
}
\newcommand{\teacher}{%
\ifmathcourse
Bill%
\else% not mathcourse
Susan%
\fi
}
\newif\ifmathcourse% default is \mathcoursefalse
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
\mathcoursetrue% This is a math course
Course: \course \par
Teacher: \teacher
\end{document}
Perhaps, for multiple course, you can define each in terms of their name and teacher by some id. Below, \setcourse{<course>}{<name>}{<teacher>} sets this up, while \coursename and \courseteacher extracts that content.
Course: Mathematics
Teacher: Bill
Course: Physics
Teacher: Susan
\documentclass{article}
\newcommand{\currentcourse}{}
\newcommand{\course}[1]{\renewcommand{\currentcourse}{#1}}
\makeatletter
\newcommand{\coursename}{\@nameuse{course@\currentcourse @name}}
\newcommand{\courseteacher}{\@nameuse{course@\currentcourse @teacher}}
% \setcourse{<course>}{<name>}{<teacher}
\newcommand{\setcourse}[3]{%
\@namedef{course@#1@name}{#2}%
\@namedef{course@#1@teacher}{#3}%
}
\makeatother
\setcourse{math}{Mathematics}{Bill}
\setcourse{physics}{Physics}{Susan}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
\course{math}
Course: \coursename \par
Teacher: \courseteacher
\course{physics}
Course: \coursename \par
Teacher: \courseteacher
\end{document}
One can build in error-checking, if needed.
\ifthenelseisn't really expandable, that's why it fails. It should be possible withexpl3features, however – Jan 25 '16 at 04:46ifthenpackage obsolete? – Werner Jan 25 '16 at 04:50