0

In actionscript, some code goes like this: trace();. So in trace statements I can both use an apostrophe or quotes. So is there any difference if I'm using each one? Example: difference between trace("Works!"); and trace('Works!');. Is there any reason why each works and not just one?

4

1 回答 1

1

唯一的区别是报价标记和需要转义。(也就是说,某些语言不同,两​​种形式之间没有特殊规则。)

AS3 开发人员指南创建字符串文章讨论了使用一个引号而不是另一个引号 - 这一切都归结为何时需要转义特定的引号。

您可以根据字符串文字中存在的任何单引号或双引号来选择使用单引号或双引号,如下所示:

var str1:String = "ActionScript <span class='heavy'>3.0</span>";

var str2:String = '<item id="155">banana</item>';

于 2013-04-28T20:14:56.360 回答