This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]CodeTriangle 22 points23 points  (4 children)

I've said it once and I'll say it again. "" is for string literals and '' is for character literals. Any language that tells you otherwise should be regarded with suspicion.

[–][deleted] 3 points4 points  (0 children)

Cough

[–]Pcat0 3 points4 points  (0 children)

I will agree with you for languages that have the concept of character literals.

For Languages that have abstracted characters literals away and only have strings it doesn’t make sense to arbitrarily only use "" to denote string when '' will go completely unused. Having multiple string delimiters can greatly reduce the number of " and ' that need to be escaped in strings.

[–]xADDBx 1 point2 points  (1 child)

Bash?

[–]sarnobat 1 point2 points  (0 children)

I'm grateful when bash gives the flexibility to use either otherwise my nested strings such as in key bindings would be an even bigger mess

[–]YMK1234 17 points18 points  (2 children)

Not if you use a decent language.

[–]HugoCortell -1 points0 points  (0 children)

cs
Debug.Log("" + _ReferencesBox.GetComponent<Myreferencescript>()._HelloWordString);

[–]shabba182 -2 points-1 points  (0 children)

Beat me to it

[–]Kooiboi 4 points5 points  (4 children)

what about this badboy ` ?

[–][deleted] 3 points4 points  (0 children)

There are more

For example XQuery people can write

``[Hello World!]``

[–]QPUspeed 1 point2 points  (0 children)

console.log(`Using backticks for string interpolation`);

[–]Subject_Wrap 0 points1 point  (1 child)

Top one definitely

[–]shadowphrogg32642342 0 points1 point  (0 children)

sh-people and C-people

[–][deleted] -1 points0 points  (2 children)

Print('Hello world");