Preference: Single or Double Quotes?

Hello,

I’m just curious whether you define strings with either single or double quotes. In fact, I’m so curious I added a poll LOL. When I first learned JavaScript, I used single quotes because that’s what most of the online examples used. If I’m not mistaken, there are at least a couple of instances where using double quotes are preferable:

  1. Building an SQL query
  2. Defining dialog text that uses the \n character (I think you need to use double quotes here).

Anyway, which type of quotes do you prefer?

Regards,
Sean

What is your coding preference?
  • Single quotes
  • Double quotes
  • Mix and match as needed
  • JavaScript? Real programmers use assembly language
0 voters

Hi Sean, I like to use double quotes.

Almost all of the sample code in our plugins are proof of that statement :)

Case 1) is indeed one where it is easier to use double quotes to avoid having to escape your single quotes.
Case 2) should also work with single quotes.

The reason is, for me, quite simple. Single quotes are not accepted by Java so using double quotes is like a habit for me…

Can you add a category: ‘Assembly? HAH! Real programmers use punch cards!’
I would vote for that.

:D

Hmm, in that case I vote for using a feather to write everything down again…

But with punch cards you have a unique code randomizer you don’t find in any other language or technique!

You throw your stack of punch cards on the floor and pick 'm up again.
Works EVERY time! :twisted:

Hmm, but with paper you can work with a roll. That way the order is secured like nothing else…

Maybe so, but punch cards come with punch lines… ;)

And paper with help lines to write nicely

Take the best of both worlds: punch holes in the roll of paper…

And some jokes hit the spot :D , others fly WAY over… :shock:

I must be getting old… yes, I worked with punch cards. I’m doing this from memory… was it an IBM 029 keypunch machine. I used these in high school on an IBM 1130. I also took advantage of the MIT High School Studies Program on Saturdays where undergrad students taught programming to local high school “geeks”, and MIT also gave us time on their IBM 360. using RJE (remote job entry)… WAY COOL! Most of the guys that I hung out with are still quite active in the computer world.

Yup… I’m getting old.

Cheers,

Rich

Rich, when I was in high school, we went to Cal Tech to use their 360s. Interesting how proximity to that technology may have influenced us both. Although, proximity to California counterculture probably had a bigger impact on me! :wink:

Tofuzilla

Jim,

The IBM 360’s at MIT, and in the general Boston area, were all very conservative… probably very different in CA…

:-))

Rich

When I was at highschool learning about the printing industry we were first tought how to work with punch cards. After typesetting we had to re-read the data and edit it on a line display using a large trackball.

The teacher didn’t allow the guys to work with it. His excuse was the sensibility of the needles reacting to trackball movements. Only women were allow to touch the trackbal with a pressure of xxx/cm2.

LOL