7

For strings: single quotes or double quotes?

Which ones do you prefer?

Comments
  • 1
    In php I prefer double quotes because I'm too lazy to escape strings to concat variables. Bonus: I feel it makes the code more readable (or as readable as my codes get)
  • 0
    The same
  • 4
    Double quotes since single quotes are for chars in (AFAIK) all compiled languages
  • 0
    I try to use whichever occurs less in the actual text I will be using in that app (which I guess mostly applies to front end). So I switch based on content and then get confused when I go back to languages that require double quote 😔
  • 6
    ‘Inconsistency”
  • 1
  • 0
    'Single' or $mystring$dollar$mystring$ - only possible choices in language I use and I like both. Double quotes are reserved for naming identifiers, sort of like object names.
  • 1
    css:after {

    content:'hello';

    }

    but print("world") - in any other programming/scripting language
  • 0
    Double!!
  • 2
    depends, in some languages single quotes identify a single character and double quotes a string

    char = 'A'
    string = "ABC"
  • 3
    Backticks in JS ``
  • 1
    " where I can so apostrophes don't cause an error
  • 1
    Whichever requires less escaping. Except when they're nested then the preference is just to get it working and move on.
  • 3
    Double quotes. Single for single chars.
  • 0
    Idgaf. I download the standard style on my editor and set it to prettify on save. Then I type however the heck I feel like that day.

    Usually double quotes though, since it's the standard for strings.
Add Comment