Comments
Comments
Function
Comments are explanatory text written for humans to explain why the code is written this way, what are the boundaries of a certain section of logic, or to temporarily record matters that need attention. Comments are ignored when BT runs the code, and they do not create variables, return values, or runtime overhead.
Single-line comments
Single-line comments start from // and end at the end of the current line. Good for explaining a line of code, marking a short explanation, or temporarily turning off a line of code while debugging.
//Calculate the total price of the user's order total = price * count
Multi-line comments
Multi-line comments start from /* and end at */. Suitable for describing an algorithm, interface convention, configuration block, or temporarily closing multiple lines of code.
/* Check whether the user is signed in here. If a permission system is added later, role checks can be added here. */ if !user_id { return 'Not logged in' }
Usage suggestions
- Use
//for single-line descriptions, use/* ... */for multi-line descriptions or temporary blocking of large paragraphs. - Comments should be kept in sync with the code. Outdated comments are more likely to mislead readers than no comments at all.