using the gerund in Spanish
Is there a rule for using the gerund (the ing ending of the verb in English) in Spanish. Sometimes I see a phrase, for example, I am leaving or I was leaving, translated as salgo or salia. And other times I see it translated as estoy saliendo or estaba saliendo.
Are they both correct ?