|
Onetastic Macro Documentation >
>
Comments
You can provide comments in your macros to improve readability and explain what your code does. Onetastic Macro Language supports two types of comments:
- End-of-line comments starting with
// - Everything after // to the end of the line is a comment
- Inline comments enclosed in
/* ... */ - Can appear anywhere within a line, including within expressions
End-of-Line Comments
End-of-line comments begin with // and extend to the end of the line. This is the most common way to add comments:
Copied!
$dialog_box = DialogBox_Create("")
DialogBox_AddTextBox($dialog_box, "&Find what", $Search, "", false)
DialogBox_AddTextBox($dialog_box, "&Replace with", $Replace, "", true)
$Options = Array("Current page", "Current section", "Current notebook")
DialogBox_AddDropDown($dialog_box, "&Scope", $Scope, "Current section", $Options)
DialogBox_AddCheckBox($dialog_box, "Match &case", $MatchCase, false)
DialogBox_Show($dialog_box)
Inline Comments
Inline comments are enclosed in /* ... */ and can appear anywhere within a line, including within expressions. They cannot span across multiple lines:
Copied!
DialogBox_AddTextBox($d, "&Find", $Search, "", false)
DialogBox_AddTextBox($d, "&Replace", $Replace, "", true)
Commenting-Out Code
Comments can be used to temporarily disable code. You can use either // or /* ... */ to comment out one or more lines:
Copied!
$dialog_box = DialogBox_Create("")
DialogBox_AddTextBox($dialog_box, "&Find what", $Search, "", false)
DialogBox_AddTextBox($dialog_box, "&Replace with", $Replace, "", true)
DialogBox_Show($dialog_box)
|