A function is allowed to be discontinuous.
As long as each valid input x is mapped to one (and only one) value y (=f(x)), and each value f(x) corresponds to a valid value of x, it is a function. You will notice when continuity is required, the text will always say continuous function.
Note also that a function may have sharp corners. For this reason, when "smoothness" is required, the text will say a continuous and smooth function, or similar.
I edited my previous post b/c it was the definition of a 1-to-1 function (where each y maps back to exactly one x, but that excludes functions like y = x^2)