Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Salmakis6737yI learned it with " 20 years ago, and so i still use". For me the ' is only if a string is in a string.
Like
script="console.log('bla')";
With "im usually save among most languages, since ' is char in some -
If I'm not working on a DB:
" surrounds a string.
' surrounds a character.
Anything else is just asking for problems either when you have to port code, or when you get a new dev on your team who's used to working in a different language. -
spacem18447yIn javascript you must use single quotes inside html attributes so may as well be consistent and use them everywhere.
-
Gophyr19227yI learned C before I learned Python. So, because I can, I use " strings and ' for single characters, just like C does.
-
devios157707yI almost always use " for strings, because in my experience it's more common to want to use an apostrophe inside a string than it is to need a double-quote.
But if I'm quoting some XML or something darn right I'll use ' instead of replacing all those "'s with \"'s. ;) -
@SecondThread Lol, you're right. Just checked the sources for my two pictures (just random grabbed from Google Images). The first is indeed Ted Cruz.
You're good!
Just firing up a new war which will be just as important in a few decades (if not today already) like Vim&Emacs.
So: Do you use 'string' or "string" in languages like JS, Python, ...?
undefined
convention war
apostrophe vs double quotes