-2

I'm confusing with use of gerund or infinitive, I don't know which one of them I should use, for example ;

I'm looking for a function to reverse a string
I'm looking for a function for reversing a string

can someone tell me which one is correct and why ?

Thanks.

John Lawler
  • 107,887
  • 4
    Why do you assume only one can be correct? That's usually the wrong way to bet, unless there's an ESL textbook in the woodpile. Both are in fact grammatical and colloquial, and both mean the same thing. The infinitive to reverse a string will be interpreted as a purpose infinitive, and the for with the gerund is the normal purpose marker. As usual, there is a choice, and people will vary, often from minute to minute, in which one they use in which context. – John Lawler Feb 20 '21 at 21:29
  • 1
  • I'm looking for a function that reverses* a string. They're all fine. And that's not to mention I'm looking for a string-reversing function*. – FumbleFingers Feb 21 '21 at 14:27

1 Answers1

2

In a comment John Lawler wrote:

Why do you assume only one can be correct? That's usually the wrong way to bet, unless there's an ESL textbook in the woodpile. Both are in fact grammatical and colloquial, and both mean the same thing. The infinitive to reverse a string will be interpreted as a purpose infinitive, and the for with the gerund is the normal purpose marker. As usual, there is a choice, and people will vary, often from minute to minute, in which one they use in which context.

tchrist
  • 134,759