A switch comprising: a magnet assembly comprising at least one first magnet ; and a first magnetic field detector , which outputs a first electrical signal, and a second magnetic field detector , which outputs a second electrical signal, the first magnetic field detector and the second magnetic field detector being arranged at a spatial distance with respect to one another and being arranged on both sides next to the magnet , and an electric or electronic evaluation unit , sensitive surfaces of the first magnetic field detector and of the second magnetic field detector being oriented parallel to one another, and the magnet assembly being arranged movably between the first magnetic field detector and the second magnetic field detector in a relative movement parallel to the sensitive surfaces, a vector of the magnetic field detected by the first magnetic field detector and a vector detected by the second magnetic field detector , in a first final position of the relative movement and in a second final position of the relative movement, having different signs only in one detected component of the vector of the magnetic field, and the electric or electronic evaluation unit being connected downstream of the first magnetic field detector and the second magnetic field detector and configured to ascertain a difference between the first electrical signal and the second electrical signal, and to output a first switch signal when an established first value of the difference is reached during the relative movement from the first final position into the second final position of the relative movement, and to output a second switch signal when an established second value of the difference is reached during the relative movement from the second final position into the first final position of the relative movement. a magnet assembly comprising at least one first magnet ; and a first magnetic field detector , which outputs a first electrical signal, and a second magnetic field detector , which outputs a second electrical signal, the first magnetic field detector and the second magnetic field detector being arranged at a spatial distance with respect to one another and being arranged on both sides next to the magnet , and an electric or electronic evaluation unit , sensitive surfaces of the first magnetic field detector and of the second magnetic field detector being oriented parallel to one another, and the magnet assembly being arranged movably between the first magnetic field detector and the second magnetic field detector in a relative movement parallel to the sensitive surfaces, a vector of the magnetic field detected by the first magnetic field detector and a vector detected by the second magnetic field detector , in a first final position of the relative movement and in a second final position of the relative movement, having different signs only in one detected component of the vector of the magnetic field, and the electric or electronic evaluation unit being connected downstream of the first magnetic field detector and the second magnetic field detector and configured to ascertain a difference between the first electrical signal and the second electrical signal, and to output a first switch signal when an established first value of the difference is reached during the relative movement from the first final position into the second final position of the relative movement, and to output a second switch signal when an established second value of the difference is reached during the relative movement from the second final position into the first final position of the relative movement. <EOS>