Example #1: You may be given a function like $f: \mathbb{R} \to \mathbb{R}$ such that $f(x) = x + 1$. Here, both the domain and the codomain are the set $\mathbb{R}$ (Remember what $\pmb{\mathbb{R}}$ stands for?)
Example #2: You may be given a function like $f: \mathbb{Z} \to \{-1, 0, 1\}$ such that $f(x) = \text{Sign}(x)$. Here, the domain is the set of all integers, and the range is the set $\{-1, 0, 1\}$.
This function takes an integer and outputs a number as follows: if the input is $0$, the output is $0$; if the input is positive, the output is $1$; and if the input is negative, the output is $-1$. For simplicity, we can say that $f: \mathbb{Z} \to \mathbb{Z}$ (= the codomain is $\mathbb{Z}$, which definitely contains $\{-1, 0, 1\}$.)
Example #3: You may be given a function like $f: \mathbb{N} \to \{n \mid n = 2k, k \in \mathbb{N}\}$ such that $f(x) = 2x$. Here, the domain is the set of natural integers, and the range is the set of even, non-negative integers (because when we do $2x$ where $x$ is an integer, we get an even integer.)
For simplicity, we can say that $f: \mathbb{N} \to \mathbb{N}$ (= the codomain is $\mathbb{N}$.)