Latent heat is released when going from gas to liquid or liquid to solid or gas to solid.