Where to place comments?

Just starting out? Need help? Post your questions and find answers here.
Blankname
Enthusiast
Enthusiast
Posts: 120
Joined: Sun Oct 14, 2012 9:11 am

Re: Where to place comments?

Post by Blankname »

Wherever you wish to place them, as they are ignored by the compiler completely. It usually used to detail and explain the line of code directly underneath the comment (exampled below). Just keep in mind comments are only there to help refresh your brain on complex things (e.g. why do it this way, instead of that way). Commenting everything is just pointless. Tho you could if you really wanted to, its whatever you wanna do.

Code: Select all

;This procedure does something
Procedure DoSomething(Parameter.i)
  ;Displays the parameter passed to the DoSomething procedure
  MessageRequester("", "Parameter is "+Str(Parameter)+"!")
EndProcedure

DoSomething(1)
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Where to place comments?

Post by Zach »

I don't know if I really have a style myself, either.

But I have approached it as a "depends" kind of thing. In general I keep comments inside and outside of procedures, based on the specifics of what is going on. Some are merely for organizational purposes, while others are to help me remember how or why I did something a certain way...

I think placing comments inside procedures can at times, be "ugly". However if it is a large and more complex procedure then you can mitigate some of that by white-spacing. Overall I wouldn't do a line by line on a procedure unless it was really complex and doing things I normally would have to look up to understand.

Otherwise the only things I comment line by line, religiously, are data structures (for obvious reasons).
Post Reply