A function is an increasing function in one interval and a decreasing function in another interval, and a constant value is obtained

A function is an increasing function in one interval and a decreasing function in another interval, and a constant value is obtained

There are many such functions, so the answer is not unique. For example: function y = ax & sup2; + B (a ≠ 0 and B ∈ R), when a > 0 (no matter which real number B is), the function is a decreasing function in the interval (- ∞, 0); and it is an increasing function in the interval [0, + ∞). Is this answer OK?