Comments

CaupolicanDiaz139 total contributions
Published Jul 23, 2021Updated Sep 1, 2023
Contribute to Docs
Comments are text within a program that are not executed by the compiler that may aid in describing what is happening in the code.
Single-line Comments
Single-line comments start with a #
.
# I am a single line comment.
Multi-line Comments
Multi-line comments start with =begin
and end with =end
.
=beginI am a multi line comment.I can take as many lines as needed.=end
Example
The example below shows how single-line comments can be used in code.
# This example uses a loop to sum only the even valuescount = 0for i in 1..10 doif (i % 2 == 0)count += iendendputs count# Yields a total of 30
All contributors
- CaupolicanDiaz139 total contributions
- christian.dinh2481 total contributions
- Anonymous contributorAnonymous contributor3077 total contributions
- CaupolicanDiaz
- christian.dinh
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.