Continuity of a function when domain and range are not real numbers Let $f:\mathbb{Q}\rightarrow \mathbb{Q}, f(x)=x$ and choose $\epsilon=\delta$ then
$\left| f(x)-f({ x }_{ 0 }) \right|<\epsilon$ and $\left| x- x _ 0\right|<\delta$ for $x_0,\epsilon,\delta\in D(f)$: so limit exists and the function is continuous(in its domain). Is it correct or I have done some blunder as I usually do.
My main question is: Can a function be continuous(in its domain) when domain and range are not real numbers. If not,why not? And if it is, then what type of continuity is this?
 A: The $\varepsilon$-$\delta$ definition of continuity is good for any function $f\colon S\to T$, with $S$ and $T$ being subsets of $\mathbb R$ of any kind whatever. Indeed, it’s good for any pair $(S,T)$ of metric spaces, but I guess you’re not yet at a stage where this should be important.
A: The Definition
Let $f$ be a function from some subset of $\mathbb{R}$, call it $D$ for domain, to another subset of $\mathbb{R}$, call it $C$ for codomain. That is,$$f:D\subseteq\mathbb{R}\to C\subseteq\mathbb{R}$$
Let $a$ be an arbitrary element of the domain. That is, $$a\in D$$
$f$ is continuous at $a$ if for each $\epsilon>0$, there exists $\delta>0$ such that for each $x\in D$, if $|x-a|<\delta$, then $|f(x)-f(a)|<\epsilon$. Moreover, $f$ is continuous if for each $a\in D$, $f$ is continuous at $a$.
An example
Define $f:\mathbb{Q}\to\mathbb{Q}$ by $$f(x)=x$$ for every $x\in \mathbb{Q}$.
$f$ is continuous.
Proof. To prove $f$ is continuous, we will show that for each $a\in\mathbb{Q}$ and for each $\epsilon>0$, there exists $\delta>0$ such that for each $x\in\mathbb{Q}$, if $|x-a|<\delta$, then $|f(x)-a|<\epsilon$.
Let $a\in \mathbb{Q}$ be arbitrary. Let $\epsilon>0$ be arbitrary. We will show that there exists $\delta>0$ such that for each $x\in\mathbb{Q}$, if $|x-a|<\delta$, then $|f(x)-f(a)|<\epsilon$.
Define $\delta\overset{\text{def}}{=}\epsilon$. We will show that for each $x\in\mathbb{Q}$, if $|x-a|<\delta$, then $|f(x)-f(a)|<\epsilon$.
Let $x\in\mathbb{Q}$ be arbitrary. We will show that if $|x-a|<\delta$, then $|f(x)-f(a)|<\epsilon$.
Assume $|x-a|<\delta$. We will show that $|f(x)-f(a)|<\epsilon$.
$$|f(x)-f(a)|=|x-a|<\delta=\epsilon$$
We have shown that $|f(x)-f(a)|<\epsilon$.
As a result, $f$ is continuous.$\square$
The definition alone should answer your question. The proof above is much too pedantic, but I believe that it will be instructive for understanding what continuity is, and how to utilize the definition to prove functions are indeed continuous such as $f$.
