Actually, JC, it is electromechanical. The flame playing on the thermocouple produces between 1/4 to 3/4 of a volt, that is 250 to 750 millivolts. This electricity is used to hold the solenoid coil of the gas valve open. When the pilot light goes out or wavers, the voltage is reduced and the solenoid valve is allowed to snap shut. Then the gas that was allowed to pass by when you pushed the pilot button open is also stopped because the pilot light button pops up to shut the valve seat.