Sugar is merely annoying, and difficult to get out of mechanical parts. Salt is WAY worse; chlorides on their own corrode stuff like mad, and if electric current is involved (batteries, power supplies…), the anodes dissolve actively and the metals transfer to cathodes. That can break thinner structures in perhaps even in minutes.
Coke is worse than sugar alone; contains phosphoric acid and is a good electrolyte, so some of the salt concerns apply.