Databasics

Code Annotations and Embedded Formula Comments

This week’s tech tip is as valuable as it is simple. As your formulas become more and more complex and the number of lines in your programs increases, you will find it useful to embed comments inside the code itself. This will enable you to better understand your syntax and automated processes when it’s time to return to your code for enhancement, testing and debugging.

To embed comments and annotations inside of your code, simply enclose the entire text string in double quotation marks (example: “Date of Last Code Update: Jan 21, 2017”).

Recommended uses of this code documenting technique include describing the use of variables, explaining the purpose of loops and decision structures and indicating where a specific section of code begins and ends. An example of the annotated code is displayed below in red:

The comments in lines 2, 10, 19 and 26 above describe the code blocks in the lines that follow while the first and last lines (1 and 34 respectively) describe the purpose of the entire code block when it was last updated.

image.png

The embedded carriage returns at lines 8, 17, 24, and 32 are there to make it easier to see where one sub-process ends and the next begins. Annotating your code as you write it will make it easier to leverage, test and share your code across large databases and with other members of your Ninox team.

en_USEN