Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua: comments.md incorrectly shows comment close as ]]-- #5925

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions content/lua/concepts/comments/comments.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
Title: 'Comments' # Required; the file name should be the same as the title, but lowercase, with dashes instead of spaces, and all punctuation removed
Description: 'A comment is text within a program that is not being executed. It can provide additional information to support understanding the code.' # Required; ideally under 150 characters and starts with a noun (used in search engine results and content previews)
Subjects: # Please only use Subjects in the subjects.md file (https://github.com/Codecademy/docs/blob/main/documentation/subjects.md). If that list feels insufficient, feel free to create a new Subject and add it to subjects.md in your PR!
Title: 'Comments'
Description: 'A comment is a text within a program that is not being executed. It can provide additional information to support understanding the code.'
Subjects:
- 'Computer Science'
Tags: # Please only use Tags in the tags.md file (https://github.com/Codecademy/docs/blob/main/documentation/tags.md). If that list feels insufficient, feel free to create a new Tag and add it to tags.md in your PR!
Tags:
- 'Comments'
- 'Documentation'
CatalogContent: # Please use course/path landing page slugs, rather than linking to individual content items. If listing multiple items, please put the most relevant one first
CatalogContent:
- 'learn-lua'
- 'paths/computer-science'
---

A **comment** is text within a program that is not being executed. It can provide additional information to support understanding the code.
A **comment** is text within a program that is not being executed. It can provide additional information to help understand the code.

## Single-line Comments

In Lua, two consecutive dashes are used to create single line comments. The compiler does not read any text after `--` on the same line.
In Lua, two consecutive dashes are used to create single-line comments. The compiler reads no text after `--` on the same line.

```lua
function sum(number1, number2)
Expand All @@ -29,11 +29,12 @@ The comment does not affect the function.

## Multi-line Comments

In Lua, multi-line comments are created using the `--[[` syntax to start the comment, and `]]--` to end the comment. The compiler does not read any text in between.
In Lua, multi-line comments are created using the `--[[` syntax to start the comment and `]]` to end the comment. The compiler does not read any text in between.

```lua
--[[ this is a multi-line comment.
The compiler
will not run code
written in between. ]]--
written in between.
]]
```