如何在VBScript中添加注释? [英] How do you add comments in a VBScript?
问题描述
我有一些VBScript,我想在代码中添加一些解释。
I have some VBScripts I would like to add some explanation to within the code.
是否有用于添加注释的语法?
Is there some syntax for adding a comment?
推荐答案
如何在VBScript中注释代码?
如有疑问,请查看文档
来自雷姆声明
如语法部分所示,您可以使用撇号('
),而不是Rem
关键字。如果Rem
关键字在一行的其他语句之后,则必须用冒号将其与这些语句分隔开。但是,当您使用撇号时,在其他语句之后不需要冒号。
Taken from Rem Statement
As shown in the syntax section, you can use an apostrophe ('
) instead of theRem
keyword. If theRem
keyword follows other statements on a line, it must be separated from the statements by a colon. However, when you use an apostrophe, the colon is not required after other statements.
下面是使用这两种方法的示例
Below is example using both methods
Rem This is a comment
'This is also a comment
Call SomeFunction(SomeValue) : Rem This is an inline comment
Call SomeFunction(SomeValue) 'This is also an inline comment
没有真正的理由使用 Rem
,它只是来自BASIC 。在我看来,撇号方法的效果很好,但不那么令人讨厌,但完全是用户喜好。
There is no real reason to use Rem
it's just a throw back from BASIC. The apostrophe approach works just as well as it is less intrusive in my opinion but it is entirely user preference.
VBScript不支持块注释。每行必须以 Rem
或撇号'
开头。
VBScript does not support block comments. Each line must start with either Rem
or an Apostrophe '
.
- Commenting code in ASP Classic1
- Server-side comments: What's the equivalent of <%— --%> in ASP Classic?1
1 适用于 asp-classic ,该问题使用 vbscript
这篇关于如何在VBScript中添加注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!