Comments
All programmers strive to make their code easy to understand, but sometimes extra explanation is warranted. In these cases, programmers leave comments in their source code that the compiler will ignore but people reading the source code may find useful.
Here’s a simple comment:
// hello, world
In Pint, the only comment style supported starts a comment with two slashes, and the comment
continues until the end of the line. For comments that extend beyond a single line, you’ll need to
include //
on each line, like this:
// This is some complicated code that requires multiple lines to explain:
// 1. The first predicate, called `GetRich` ensures that we're getting rich.
// 2. The second predicate, called `BeResponsible` ensures that
// we're not gambling all the money away.
Comments can also be placed at the end of lines containing code:
let big_answer = 42; // answer to life, the universe, and everything
But you’ll more often see them used in this format, with the comment on a separate line above the code it’s annotating:
// answer to life, the universe, and everything
let big_answer_too = 42;