More general definitions of this kind of function can be obtained by replacing the absolute value by the distance function in a metric space, or the entire continuity definition by the definition of continuity in a topological space.
On example of such a function is a function f on the real numbers such that f(x) is 1 if x is a rational number, but 0 if x is not rational. If we look at this function in the vincinity of some number y, there are two cases:
If y is rational, then f(y)=1. To show the function is not continuous at y, we need find a single ε which works in the above definition. In fact, 1/2 is such an ε, since we can find an irrational number zarbitrarily close to y and f(z)=0, at least 1/2 away from 1. If y is irrational, then f(y)=0. Again, we can take ε=1/2, and this time we pick z to be an rational number as close to y as is required. Again, f(z) is more than 1/2 away from f(y)
The discontinuities in this function occur because both the rational and irrational numbers are dense in the real numbers. It was originally investigated by Dirichlet.)