As the title says. I feel like it should be ok as long as it's not in the answer, but thanking people and generally adding unnecessary stuff (as opposed to things that are directly related to the question) seem discouraged here, so I'm just asking to make sure.
Thank you for asking this.
A comment like "+1, this helped me a lot, thanks!" is discouraged, per the help center:
Please do not add a comment on your question or on an answer to say "Thank you". Comments are meant for requesting clarification, leaving constructive criticism, or adding relevant but minor additional information – not for socializing. If you want to say "thank you," vote on or accept that person's answer, or simply pay it forward by providing a great answer to someone else's question.
The built-in way to say "thank you" is voting up (which requires 15 reputation due to irrelevant but important reasons) or accepting the answer (if it answered your question adequately). Thanking the author is noise, and I seriously recommend considering commenting only when
- you have some clarifications to do about the answer.
- you have further insight that's useful for other people to read. About the question or the answer.
- you believe something else needs to be issued about the answer, e.g. it's wrong etc.
Don't comment when
- you want to start a chat with the answerer.
- you have another question, even if it's related to the subject.
- you have something to say that isn't relevant.
- you need some help with using the site's features.
Of course you can. People do it all the time.
You should remember that it is not recommended by the SE team. It is also often perceived as clutter and/or noise. Maybe your comment will be flagged and then deleted. If that is the case, please don’t be angry. Understand that comments are not meant for eternity.
And also remember, as the German saying goes: You never eat the food as hot as it is cooked ;)