English 中文(简体)
我如何在咖啡发表评论? “* 本*/”
原标题:How do I comment in CoffeeScript? "/* this */" doesn t work

在咖啡典上,你能以什么方式发表意见?

文件指出,你可以使用三个散列符号来开始并关闭一个评论组:

###
  Comments
  go
  here
###

我发现,我有时可以使用以下两种格式:

`// backticks allow for straight-JavaScript,
 // but the closing backtick can t be on a comment line (I think?)
`

在咖啡厅里添加短语是否比较简单?

NOT使用这一风格* * E/CN.6/2009/1。

鉴于这一点正在获得许多意见,我要强调:

/* Comment goes here */

当<代码>/*本身行文时,会产生重大错误。

正如Trevor在关于这个问题的评论中指出的那样,这是一份的常规表述,NOT评论!

最佳回答

使用单一编号符号

# like this

一种特性似乎极小;

此外:

###
This block comment (useful for ©-Copyright info) also gets 
passed on to the browsers HTML /* like this! */
###
问题回答

评注的主要方式是:

# This comment goes to the end of the line
# and it won t appear in the "compiled"
# JavaScript version.

页: 1 缩略语 当你想在 Java本中发表评论时:

有时,你希望通过老的Java出版社发表一个小篇评论。 例如,当你需要把许可证的负责人放在档案的顶端。 缩略语与此处的合成物一样,在生成的法典中保留。

因此,如果你开始的话。

###
PancakeParser is Public Domain
###

之后,你将 Java本大本发表评论:

/*
PancakeParser is Public Domain
*/

• 了解第2号: 如果你使用第#号,将代码的单独部分(如我所做的那样)分开使用,那么当该法典停止工作时,这令人感到非常奇怪。

在一行中,试图:

if somecond `/* hi */` && some other cond, etc.

The backticks cause CoffeeScript to put the enclosed text into the generated JavaScript as is.

不幸的是,《咖啡典》与采用单一特性的评论是否使之与《 Java本》产出不符。 例如:

# testme.coffee

fName =  John 
lName =  Smith 
fullName = "#{fName} #{lName}" # |||| $:
if true #comment
    console.log `/* hi */`  Hello, World! 

汇编

// Generated by CoffeeScript 2.7.0
(function() {
  // testme.coffee
  var fName, fullName, lName;

  fName =  John ;

  lName =  Smith ;

  fullName = `${fName} ${lName}`;

  if (true) { //comment
    console.log(/* hi */`Hello, World!`);
  }

}).call(this);

注 缺失关于分配给Name的界线的评论。





相关问题
VS 10 mangles html comments?

Using the latest VS 10 we created html markup, then commented it with html comments. The file on disk is not mangled, but when it renders, it renders the html comment tags, then removes some of the ...

Comments & OpenSource software [closed]

This may sound like a foolish question or an observation, but i have seen that most of the times when one tries to look at the opensource code, there are no comments or just one or two lines at the ...

Including commented Class declaration in implementation file

Everyone knows the advantages of a more readable code. So in order to make my code more readable what i do normally is include the commented class declaration in the implementation file of that class....

pair programming with comments [closed]

Over the years, I ve discovered that green-programmers tend to read the comments rather than the code to debug issues. Does having one person document the other person s code (and vice-versa) with ...

Commenting JavaScript functions á la Python Docstrings

It is valid JavaScript to write something like this: function example(x) { "Here is a short doc what I do."; // code of the function } The string actually does nothing. Is there any reason, ...

热门标签