cookieundercover cookieundercover - 5 months ago 19
Brainfuck Question

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

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.


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