DEV Community

Discussion on: My take on commenting code - Explain why, not how

Collapse
 
gudata profile image
gudata

Here is one more usage of the comments in order this article to be complete.

When I want to write something with multiple steps I like to draft them as

# Do first
# for each item
# do something else
# Do final thing
Enter fullscreen mode Exit fullscreen mode

So then I implement the logic bellow the comments

first()
for each item in items:
  something_else()
final()
Enter fullscreen mode Exit fullscreen mode
Collapse
 
nombrekeff profile image
Keff

Fantastic addition, I also do this, it's a simple way to map out your ideas. I either do it with comments or using a markdown file, I prefer using markdown as I can then keep a log of what my thought process was at the time!