5

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, ...?

Comments
  • 3
    I 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
  • 3
    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.
  • 0
    In javascript you must use single quotes inside html attributes so may as well be consistent and use them everywhere.
  • 0
    I learned C before I learned Python. So, because I can, I use " strings and ' for single characters, just like C does.
  • 1
    I 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. ;)
  • 0
    ' are my choice. Cleaner looking.
  • 2
    Is that Ted Cruz?
  • 1
    @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!
Add Comment