Comments in Nuru
In Nuru, you can write comments to provide explanations and documentation for your code. Comments are lines of text that are ignored by the Nuru interpreter, so they will not affect the behavior of your program. There are two types of comments in Nuru: single-line comments and multi-line comments.
Single-Line Comments
Single-line comments are used to provide brief explanations or documentation for a single line of code. To write a single-line comment in Nuru, use two forward slashes //
followed by your comment text. Here's an example:
// This line will be ignored by the Nuru interpreter
// This line will be ignored by the Nuru interpreter
In this example, the comment text "This line will be ignored by the Nuru interpreter" will be ignored by the interpreter, so it will not affect the behavior of the program.
Multi-Line Comments
Multi-line comments are used to provide more detailed explanations or documentation for multiple lines of code. To write a multi-line comment in Nuru, use a forward slash followed by an asterisk /*
to start the comment, and an asterisk followed by a forward slash */
to end the comment. Here's an example:
/*
These lines
Will
be
ignored
*/
/*
These lines
Will
be
ignored
*/
In this example, all the lines between the /*
and `*/` symbols will be ignored by the Nuru interpreter, so they will not affect the behavior of the program.
By utilizing single-line and multi-line comments in Nuru, you can make your code more readable and easier to maintain for yourself and others who may need to work with your code in the future.