Use of present gerund
The present gerund allows the expression of a simultaneous action in relation to another event. It has a double meaning because it is both verb and adverb.
As a verb, it gives specific functions to other elements of the sentence. As an adverb, the present gerund has a circumstantial complement function.
En venant, on passera par la pharmacie.