How to write a "comment" containing a period (.) in Brainfuck?

1.4k Views Asked by At

Is there any way to do comments in Brainfuck that contain periods ('.')?

I know I can use basically every char that is not one of the commands, and it is ignored, but I would like to put a version number in a comment at the top of the file, and that contains a period.

1

There are 1 best solutions below

0
On BEST ANSWER

There's a trick you can use: a loop will not execute what's inside if it's not run and fits syntactically.

[This is a comment.]+++++++++++++++++++++++++++++++.

Indeed, if you leave out the [], this will print a NUL byte too much. You still cannot use brackets though ;)

This is akin to the shell construct:

if false; then
    this is a comment
fi