And that’s the main difference between a coil gun and a rail gun. Although they use the same principles to propel their projectile.
A rail gun (AkA Gauss Rifle) works on the same principles as a bullet train. One set of magnets is positively charged the other is negatively charged to attract or repel the metal object inside of its chamber.
That projectile doesn’t experience friction against the barrel, so it doesn’t loose any muzzle velocity until exiting the barrel, or kinetic energy. It doesn’t produce a flash when being used, doesn’t produce powder, doesn’t produce as much noise. It makes the perfect sniper weapon.
The problem with it is that the power requirements and the computing power required for such a weapon makes it impractical for cheap wide scale use.