Comment your PowerApps code!

We are happy to announce the formula commenting feature for PowerApps. Have you ever inspected a PowerApps formula and wondered just what the author was trying to accomplish? Or, maybe you’ve wondered what even you, yourself, were trying to accomplish in a formula you wrote six months ago? But, without a formula commenting feature, authors can’t leave hints, guidance, or help in the formula itself.

Now anyone can comment a formula to provide help to those who inspect it later.

Commenting Styles

We make two commenting styles possible: line and block.

Line Comments

A line comment is one that comes at the end of a formula and takes up the rest of the line. For instance, if your formula looks like the following:

You can add line comments by adding a “// <your comment here>” at the end of the line like so:

You can’t put any code at the end of the comment – the comment runs all the way to the end of the line. And, the formula assumes that the next line picks up where the comment on the previous line began.

Block Comments

The other style of comment is block comment. As shown below, it starts with the special key combination of forward slash and an asterisk and continues until explicitly terminated with the opposite key combination of asterisk forward slash.

Note that you can use the block style comment at the end of a line as well. But the line style comment is easier to use for an end of line comment.

And, sometimes people use the end of line comment in the same way the block style comments are used.

But, it’s up to you. Pick a style that works for your formulas in your PowerApp. We’d love to hear from you about this feature in the PowerApps Community.