【发布时间】:2012-06-27 11:54:32
【问题描述】:
你们如何在一些只为自己使用的简单代码上编写 cmets?
我主要编写 JavaScript 和 PHP 代码,但我真的找不到编写 cmets 的好方法。
如果我有一小段代码,我通常会这样做:
x = doThis(getSomeValueFromSomewhere()); // This is a short line of code
我觉得这看起来很不错,但是当线路变长或多行时,它就不起作用了,
// Dont really like this since it's not clear if it describes only line 1, or all lines.
aLongerVariableName = (getSomeValueFromSomewhere() == "this is what I want") ? "true value" : "false value";
x = doThis(aLongerVariableName);
那么,你是怎么做到的呢?
【问题讨论】:
标签: comments