Front-End-Development-Guidelines icon indicating copy to clipboard operation
Front-End-Development-Guidelines copied to clipboard

Some people are very fond of their C style strings (single quotes)...

Open Garren opened this issue 13 years ago • 1 comments

"Strings should always use double quotes. Some people are very fond of their C style strings (single quotes), but this leads to conflicting styles within a script."

Maybe I've read this statement incorrectly, but:

C strings are double quoted not single quoted.

     char *s = "hello world";

C characters are single quoted.

     char c = 'c';

This is also the case with C++ (naturally), Java and C#. In fact Javascript is the only vaguely C'ish language which comes to mind that doesn't follow this convention.

Garren avatar May 07 '11 05:05 Garren

Woah, I hit "e" accidentally and it closed the issue. Apologies.

JavaScript is not able to differentiate between a phrase and a single character, as both are considered strings. I did not know that other languages could, so if the passage is vague then I hope you understand. I'm not a native C coder.

taitems avatar Jun 11 '11 07:06 taitems