Comments

Prev Next

Introduction to Comments

Documenting comments is very similar as in C/C++. The language supports following comment symbols:

Comment Types Examples Description
Line comment // Comment starting with double slashes and effective until end of line. The symbols for comment blocks /* and */ are ignored inside line comments.
Comment block /* ... */ Commented code section.
/* begins commented section
*/ ends commented sections
Commented section is not ended prematurely with line comments.
Nested comments are not supported, e.g. /* … /* … */ … */

You may wonder why obvious names such as 'if', 'while' and 'for' are not considered as similar reserved keywords. In B4P, the control flow statements are actually procedure names which then influence executing further statements or blocks. Therefore, you can actually use 'if' as the given function.

  // This is a commment
  // Bla Bla /* Bla Bla
  echo( This statement is outside a comment block );
  // Bla Bla */ Bla Bla
This statement is outside a comment block
Try it yourself: Open LAN_Features_comments.b4p in B4P_Examples.zip. Decompress before use.

Github Markdown Files

B4P understands markdown files (with filenames ending '.md') where it only executes code lines which inside the code blocks. All other contents outside the code blocks are treated like comments. Code blocks must be delimited with three accent-grave symbols ```. Multiple such code blocks in one markdown file are supported.

  # This is a markdown header
  And some text to describe it
  ```program code
  echo( This statement is inside a code block );
  ```
  # This is the next header
This statement is inside a block