This article considers the numerical treatment of piecewise-smooth dynamical systems. Classical solutions as well as sliding modes up to codimension-2 are treated. An algorithm is presented that, in the case of non-uniqueness, selects a solution that is the formal limit solution of a regularized problem. The numerical solution of a regularized differential equation, which creates stiffness and often also high oscillations, is avoided.