An electromagnet uses electric current to produce a magnetic field which can be turned on and off as required.