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?
Asked
Active
Viewed 154 times
0
-
1http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7ef8.html – user2246674 Apr 28 '13 at 20:12
-
@user2246674 Thanks! Complete link to strings reference! – Apr 28 '13 at 20:17
-
or http://stackoverflow.com/questions/2073537/difference-between-single-and-double-quoted-strings-in-actionscript - google can help you find these answers quicker than making a new question. – prototypical Apr 28 '13 at 20:17
-
Duplicate question, then! I tried searching this in google (exact search: ' flash difference between ' and " ' but nothing came up! – Apr 28 '13 at 20:19
-
@Abe "actionscript quote reference" or "actionscript quote syntax" might be better search phrases - same with operators and such; best resource for syntax is usually the authoritative reference or a companion guide. – user2246674 Apr 28 '13 at 20:20
-
@user2246674 Okay, thank you, I even flagged my own question as duplicate! – Apr 28 '13 at 20:21
1 Answers
1
The only difference is the quote token and required escaping of such. (That is, unlike some languages, there are no special rules between the two forms.)
The AS3 developer guide Creating Strings article discussed when using one quote over the other is preferable - it all comes down to when the particular quote needs to be escaped.
You may choose to use single quotation marks or double quotation marks based on any single or double quotation marks that exist in a string literal, as in the following:
var str1:String = "ActionScript <span class='heavy'>3.0</span>";
var str2:String = '<item id="155">banana</item>';

Community
- 1
- 1

user2246674
- 7,621
- 25
- 28
-
Nicely explained! I've been wondering how to put quotes in strings! (Will accept answer is 6 minutes...) – Apr 28 '13 at 20:15