Lipi

Comments

Comments are annotations in your code that are ignored by the compiler or interpreter. They are used for documentation, to explain, clarify, or temporarily disable parts of the code without affecting its execution. Comments are essential for documenting your code and making it easier for others (or yourself) to understand its purpose and functionality.

Single Line Comments

Single-line comments in Lipi start with :) and continue until the end of the line.

:) This is a single-line comment

Multi-Line Comments

Multi-line comments in Lipi start with (:) and end with :). They can span multiple lines and are useful for longer explanations or temporarily disabling blocks of code.

(: This is a
multiline
comment :)

Example

Here's an example showing both single-line and multi-line comments in a Lipi program:

:) A program to demonstrate comments
(: Comments are great.
I love comments. You love comments.
Everyone loves comments. :)

bhana("Hello, World!"); :) This prints a greeting

Best Practices

Here are some best practices for using comments in your Lipi code:

  • Use comments to explain why you're doing something, not what you're doing (the code itself should be clear enough to explain what it does)
  • Keep comments up-to-date with the code
  • Use single-line comments for brief explanations
  • Use multi-line comments for more detailed explanations or documentation
  • Document functions, their parameters, and return values
  • Avoid excessive commenting that can make the code harder to read

Next Steps

Now that you understand comments in Lipi, you can learn more about: