Features
As your Formulas become more complex, adding comments is essential for explaining your logic, documenting your intentions, or temporarily disabling parts of your code for testing. Formulas support two types of comments:
Start a line with two forward slashes //
to make the entire line a comment. You can also place //
after code on the same line to comment out the rest of the line.
Syntax: // Comment text goes here
Examples:
// --- Example 1: Explaining a variable ---
// Calculate target bid based on 14d CPC with a 15% markup
let target_bid = cpc(14d) * 1.15;
// --- Example 2: Commenting out a condition ---
clicks(30d) > 5
// and spend(30d) > 10.00 // Temporarily disabled this spend check
and state = "enabled"
Use /*
to start a comment block and */
to end it. Everything between these markers, including multiple lines, will be ignored.
Syntax: /* Comment text spanning potentially multiple lines */
Examples:
/*
This section identifies poorly performing keywords.
Criteria: No orders in 90 days despite significant spend.
Thresholds determined on 2024-10-15.
*/
orders(90d) = 0 and spend(90d) > 25.00
let calc = /* A comment inside code */ sales(7d) / clicks(7d);
Best Practices
While not affecting how your formula runs, effective commenting significantly improves the maintainability and understandability of your complex Formulas.
© Merch Jar LLC