Question on the continuity of a function Here's a question from a real analysis textbook: 


  Let $f\colon \mathbb{R} \to \mathbb{R}$ be continuous taking values in
  $\mathbb{Z}$ or in $\mathbb{Q}$. Then show that $f$ is a constant
  function.


What is the author trying to say here? The domain of $f$ is clearly $\mathbb{R}$, so it can accept values from both $\mathbb{Q}$ and $\mathbb{Z}$. Are they trying to say that it is continuous on either $\mathbb{Z}$ or $\mathbb{Q}$ and discontinuous on $\mathbb{R}\setminus \mathbb{Z}$ and $\mathbb{R}\setminus \mathbb{Q}$ respectively? The question is quite vague.
The author is saying that $f$ is a continuous function from $\Bbb R$ to $\Bbb R$ such that $f(x)\in\Bbb Z$ (respectively, "$\in \Bbb Q$") for all $x\in \Bbb R$.

And that you must prove that, with either of these assumptions, $f$ can only be constant.
Let $f$ be non-constant, and assume $f(x_0)\ne f(x_1)$. Continuity allows to apply the intermediate value theorem so that $f(x)=y$, where $y$ is an irrational number in $((f_0), f(x_1))$, must have a solution. A contradiction.