3

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.

user2864740
  • 60,010
  • 15
  • 145
  • 220
  • Hmm, now if the comment(s) were themselves [part of] the code and the entire thing read as a modern, and very long, adaptation of Shakespeare .. – user2864740 Dec 23 '14 at 23:41
  • Not quite into Shakespeare, but an "interesting" commentary of the algorithm could indeed be fun. Hm, I'll keep that in mind. – cookieundercover Dec 23 '14 at 23:49

1 Answers1

5

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
mirabilos
  • 5,123
  • 2
  • 46
  • 72