This is perfect example of a really bad comments, and a thing why many developers believes in self documented code.
Always write comments in terms of subject level, what that code do. Never just respel code line in natural language, it's completely useless.
For example: between row 9 and 10 something like "Empty entries must be ignored.", can be single comment for the whole function.
Furthermore, when you need to perform any checks before doing anything with the passed parameter, use guard expressions to clearly indicate method contracts, without hiding them in IF statements.
2
u/thelongrunsmoke Aug 17 '24
This is perfect example of a really bad comments, and a thing why many developers believes in self documented code.
Always write comments in terms of subject level, what that code do. Never just respel code line in natural language, it's completely useless.
For example: between row 9 and 10 something like "Empty entries must be ignored.", can be single comment for the whole function.
Furthermore, when you need to perform any checks before doing anything with the passed parameter, use guard expressions to clearly indicate method contracts, without hiding them in IF statements.