Comment

From Esolang
(Redirected from Comments)
Jump to navigation Jump to search

Comments are a part of a program which are not executed by the computer. They are often used to explain complicated code, or to temporarily prevent old code from running.

While most serious languages support comments of some sort, this page mostly focuses on how comments can be formed in various esolangs.

Many esolangs give you tokens for comments, so here is how to do that in some that don't and in some that do.

!!brainfeed

to make a comment in !!brainfeed:

[just write anything in matched square brackets]

*python

Asterisk is used as a token for comments

*I am a one-liner

*I am a
|multi-liner. The pipe is REQUIRED to be in a comment or else this part of the comment will not be considered be a part of the multi-line comment
*An ending asterisk is also REQUIRED to be in a comment because *python will throw syntax error

Strings cannot be used as comments in *python :(

////Thue/Expansion/A=B

To actually make a comment in /// or Thue. You just replace a character that never get's used in code. for example:

/t/hi/
Hello world

for /// and

t::=hi
::=
Hello world

for Thue and

[t]=hi
*Hello world

for Expansion.

t=hi
=(return)Hello world

for A=B

4ME

Normal 4ME

There are multiple ways to make comments. Either typing something in P:, either use the #<space> or just put something below or after E:

Rewritten 4ME

You just do it like the old boring way

{oh hi}

8ial

If program encounters an error in a command or encounters this !A. The line automatically gets turned into a comment

AREA/Hum

Comments are wrapped in pipes of all things

|This is a comment|

bog prok

´ comment ´

Brain-Flak

Comments are not a standard in Brain-Flak and thus vary between implementations.

Rain-Flak, the original Ruby implementation of Brain-Flak uses line comments initiated by a # and ending with a newline.

code # comment
code

Anything between the # and the newline will be neither parsed nor executed.

BrainHack, a later Haskell implementation also uses # to indicate a comment, however its comments are block comments enclosed in #{...}, and thus will be parsed for validity but not executed.

code #{ comment
more comment } code

Brain-Crack, an even later cross-platform C++ implementation still uses # to indicate a comment, but this time the characters between two #'s are comments and will not be parsed nor executed.

code # comment # code
# comment
more comment # code

BrainFlog and Crane-Flak have no comments.

brainfuck

An unrecognized character is a comment in brainfuck. However, if your comment contains a command, you can wrap it around with [] and put it after a loop or at the start of the program. (Anyway, the comment still has to have all square brackets matched.)

[comment]
[code][comment]

Since current cell is 0 at the start of program or after loops, the comment is never executed.

C/C++

int main() {
  //one-line
  /*
  multi-line
  */
  return 0;
}

Note: One-line comments are not available before C99!

C#

similar tokens as C and C++

/// document comments are for generating API documentations
class Program {
    static void Main(string[] args) {
               //one liner
               /*multi
               liner*/
    }
}

CLFCE

CLFCE DOESN'T have a token for comments. But there is a way to "make" comments using the compile array:

compile [1,3,6]
therm(Hello, )
This is a one line comment
therm(world! )
This is a
Multi-line comment
therm(:D)

Fungeoids

In Befunge and many other fungeoids, you can put comments in places that the IP will not enter.

>v
^<Comment (IP will never be here)

How dare you fuck the brain

Anything after will be considerd as comments:

↓ i am a one-liner

but after the creator found out about BigBrain's ! command. It turned the into a part of the claw command
So the comments are basicly the same as the hash comments in Python:

# i am not the recent HDYFTB version one-liner comment

but until today. comments are basicly the same thing as Hum and AREA

|and i didn't even take insparation from Hum and AREA in the first place|

MarioLANG

Same case with the fungeoids/brainfuck. you can just make it a part of the program or just put it somewhere where the ip wont enter

>++:
====
 hi

Python

Python uses # for one-line comments:

# Comment :D

Strings can be used as comments too:

"I am a one-line comment"
"""I am a
multi-line comment"""

They are actually a doc string. But who cares

Sakana

Sakana actually has a token for comments:

#one-liner comment#

Gammaline languages

Snakel

Comments are allowed to be outside of functions/the main function unlike C or C++

Instead of using a hash (#). You use an exclamation mark (!) as a one-liner comment

­ 1:­ !i am a one-liner

String comments do exists in Snakel

­ 1:­ "i am a multi-liner"
­ 2:­ "do you believe that now am i a
­ 3:­ multi-line comment?"

Putting a newline in a one-line comment will do:

­ 1:­ !this will\n break

You can also end comments with an exclamation mark (!)

­ 1:­ !this is also a one liner!


MarkupL

Languages with halting instructions/infinite loops

You can write comments at the end of programs in most languages that have a halting instruction/infinite loops. For example, in Deadfish variations with the h command:

h comment

Or in brainfuck:

[-]+[] comment

Or in 4ME/borth:

P:(S: if programed in borth)
E:
HOLY SHI-

or in How dare you fuck the brain

H ello

You get the idea

Chicken, Unreadable, etc.

It is impossible to write comments in these esolangs.

No-code esolangs

Any code is a comment in no-code esolangs, because the result doesn't depend on the code in these esolangs.

Here is an example of comment in Nope., a no-code esolang:

// This is a comment!
# This is a comment, too!
; This is also a comment!
Comments can be everywhere!

See also