Is the audio quality better on optical or HDMI?

Episode 1542
Bernie fromBernie wants to know if HDMI is the same as optical for audio quality. Leo says that both connections are digital, so it's the same quality. Optical will give him Atmos and other multi channel stereo options as well.