Adding code comments
Comments are parts of the code that don't get executed.
Why do I need comments?
Comments come in handy in a few situations:
- Annotating - they can describe what a specific part of the code does
- Testing - you can temporarily disable a single section to test a different part
- Documenting - comments can act as a code documentation e.g explain custom functions
With our syntax it's pretty easy to add comments:
// Single Line Comment /* Multiple Lines Comments */
Single line Comment
The first comment type, is a single line one. It can be achieved by placing to slashes on the beginning of the line:
Let's create a code and describe it with a short comment
// this part sums 2 numbers $let[num1;5] $let[num2;10] Result is $sum[$num1;$num2]
Now it's time to check if the comment worked fine
As you see the comment at line 1 didn't appear in the result
Multiple Lines Comment
In some cases you may want to comment out more then one line, or just a specific part of it. You can do that by wrapping the comment with a combination of slashes and asterisks
/* Comment */
Let's extend our previous comment with some extra lines:
/* This part Sums two numbers num1 and num2 and it send the result */ $let[num1;5] $let[num2;10] result is $sum[$num1;$num2]
Here's what the bot returns:
As you can see it didn't add any extra content despite adding more lines.
When using the dashboard editor, you can hit
/ to automatically comment out selected line(s)