Just to clarify, a digital signal traveling down a wire is really an analog signal having two possible voltage levels that switch back and forth very quickly. There are also in-between levels for a brief period as the voltage transitions from low to high (0 to 1). An optical connection is more like pure digital where the light source is either on or off. But in practice both methods work well, and don't change the sound unless something is broken.
--Ethan