#Do leave comments.
Do leave comments.
Downvotes without leaving a comment, especially when the downvote reason isn't terribly obvious, will be quickly counter-upvoted by other users, leaving the asker or answerer with a net positive reputation change. This won't help towards a question or answer ban, and it won't teach them anything.
Do not leave boilerplate comments.
I don't know why multiple sources are advocating for boilerplate comments. Reviewers do it, some users even wrote apps that post them and created GitHub repos to host them, but I loathe them. Nothing more annoying than boilerplate comments that ever so slightly don't actually apply to the post in question.
Customize comments.
Tailor your comment to the post in question, or don't bother leaving a comment at all. In this case, I'm all for a comment like this:
Please show that you debugged this code yourself. With this code, your X will do Y in scenario Z, what do you want to happen instead in that case?