Comment in formula

Is there a way to comment inside a formula as same as you can comment in coding?

7 Likes

@Guilherme_Salles this is a much requested, but non existant feature in Coda.

5 Likes

If you have a very pressing need to leave a note in a formula, there are ways of doing that. eg, you can replace some piece(of, code) with:
SwitchIf

SwitchIf("Here is my comment about this code", 
  piece(of, code)
)

WithName

WithName("comment", Here is a more visible comment without quotes, 
  piece(of, code)
)

IfBlank (only if the value won’t be blank of course)

piece(of, code).IfBlank("Here is my comment about this code")

etc

It’s not pretty, but it may be useful.

7 Likes

Just wanted to add a +1 for the ability to add //comment in a formula for future references/collaboration.

2 Likes

:wave: Hi! I’m Arpan, a software engineer at Coda. Thanks for sharing this feedback. The good news is, you can now add comments to formulas! By enclosing parts of your formulas with /* and */, that portion will become a comment. To comment out an entire line, prefix the line with //.

Formula comments can help explain what’s going on in your most complicated formulas and can also be used to save prior versions of formulas you’d like to refer back to.

2-21-23 Formula comments_2.gif

17 Likes

I am really excited about this feature!

I was just checking in if this was added. Thank you for this!!! Working on something right now and I really needed it.

@Arpan_Laha THIS DESERVE AN OFFICIAL POSTING :star_struck: :star_struck: :star_struck:

1 Like

There aren’t words to describe how happy I am about this seemingly small QOL improvement. I am SO HAPPY!!! Having to write some ridiculously complex formulas having notes is a must-have! Thank you so much Coda team!

2 Likes

Did the single line comment feature get deprecated / stop working? I have some pretty complicated formulas that have been running for some time and they stopped working recently. The comments now have square brackets around them “[” and when I remove the square brackets the formula starts to work again.

For instance I had “//this code does something” it was replaced in my formula by “//[this code does something]”

1 Like

Happened to me too with ‘’‘/* comments */’‘’, it also frequently removes all whitespace/line breaks of my meticulously formatted formulas :sweat:

Same @Martin_Portevin. I have had that happen when clicking the auto format button but never without editing the formula. I started getting notifications of a job failing and when I opened the editor all whitespace, line breaks were gone and my formulas were broken.

Formulas (and buttons) with comments continue to break. Maybe @Arpan_Laha can look into this. At this point I would much rather you delete comments from my code vs break my code.