gerund and inf are used like a subject

Hi :smiley:
“[color=red]V_ing and[color=red] to_V and[color=red] V_inf” all of them are able to be used like [color=red]a subject. But I don’t kown when we use V_ing, to_V, V_inf. :roll: please help me
Thanks

If you’re going to describe a kind of situation, then gerund will be the better choice.
*Swimming is my habbit.
If you’re saying some kind of act, then infinitive will be the one.
*To swim is what I am going to do.