We name those functions—an important set—whose range is contained in the real numbers.
A real function is a real-valued function. The domain is often an interval of real numbers, but may be any non-empty set.
Given any set $A$, $f: A \to \R $ is a real function. If $A = \R $, then $f \in \R \to \R $.
We often speak of functions defined on intervals. Given $a, b \in \R $, then $g: [a, b] \to \R $ is a real function defined on a closed interval. The function $h: (a, b) \to \R $ is a real function defined on an open interval.
We regularly declare the interval and the function at once. For example, “let $f: [a, b] \to \R $” is understood to mean “let $a$ and $b$ be real numbers with $a < b$, let $[a, b]$ be the closed interval with them as endpoints, and let $f$ be a real-valued function whose domain is this interval”. We read the notation $f: [a, b] \to \R $ aloud as “$f$ from closed $a$ $b$ to $\R $.” We use $f: (a, b) \to \R $ similarly (read aloud “$f$ from open $a$ $b$ to $\R $”).
\[ f(x) = c \quad \text{for all } x \in \R \]
\[ f(x) = 2x^2 + 1 \quad \text{for all } x \in \R \]
\[ f(x) = \begin{cases} 1 & \text{ if } x \in \Q \\ 0 & \text{ otherwise. } \end{cases} \]