[Tex/LaTex] How to overwrite/erase text in a beamer slide with pauses

beamerpause

So, I have this beamer slide you see here, and the lines are revealed one at a time with the pause function. However, I'd like not to have to repeat all the lines $$3<5$$, $$3\leq 5$$, etc. Instead, I was hoping to replace (i.e., overwrite) the \square in the second line with < and \leq, etc., as I go through the pauses.

Is this possible?

Thanks in advance!

\documentclass{beamer}
\usepackage[makeroom]{cancel}
\renewcommand{\CancelColor}{\color{red}}
\begin{document}
\begin{frame}{}
{\bf Example.}  Which of the symbols $>$, $<$, $\geq$, $\leq$, and $=$, may fill in the blank between the following?
$$3\;\square\;5$$
\pause Since 3 is less than 5, we can put ``$<$'' in the blank.
\pause $$3<5$$
\pause For the same reason, we could also put ``$\leq$'' in the blank.
\pause $$3\leq 5$$
\pause However, we could not put ``$=$'' in the blank.
\pause $$3\;\xcancel{=}\;5$$
\end{frame}
\end{document}

enter image description here

Best Answer

You could achieve this with \only.

\documentclass{beamer}
\usepackage[makeroom]{cancel}
\renewcommand{\CancelColor}{\color{red}}
\begin{document}
\begin{frame}{}
{\bf Example.}  Which of the symbols $>$, $<$, $\geq$, $\leq$, and $=$, may fill in the blank between the following?
$$3\;\only<1>{\square}
\only<2-3>{<}\only<4->{\leq}\;5$$
\pause Since 3 is less than 5, we can put ``$<$'' in the blank.
\pause $$3<5$$
\pause For the same reason, we could also put ``$\leq$'' in the blank.
\pause $$3\leq 5$$
\pause However, we could not put ``$=$'' in the blank.
\pause $$3\;\xcancel{=}\;5$$
\end{frame}
\end{document}

enter image description here