Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am currently learning Javascript, and there is one element of the syntax that I can just not seem to nail down. That element is adding semicolons at the end of each line. I have learned Python and Ruby, and written a ton of both, so the lack of semicolons is stuck in my mind! Is there a way to drill that (or even any syntax, to make this more useful to future readers) into my brain?

share|improve this question
    
Semi colons are completely optional (if you understand ASI) (mislav.uniqpath.com/2010/05/semicolons) –  Raynos Apr 12 '12 at 23:04
    
@Raynos not if you want to minify code... –  Ben Brocka Apr 13 '12 at 15:22
    
@BenBrocka any non-shitty minifier will insert semi colons for you :\ –  Raynos Apr 13 '12 at 15:55

2 Answers 2

up vote 0 down vote accepted

No tricks for this I'm afraid. As @Raynos pointed out, semicolons are optional. But if you want to learn the habit in case you might learn other languages that require them, just code slowly and remember it for each line. As you get used to the idea, you'll be able to code faster and it'll become a habit over time.

You'll only get it in the same way you got the habit of not placing any: by "writing a ton of the language".

share|improve this answer

In week #3 and language #3 of CS 103, Comparative Languages, our prof took questions about what problems we were having. Someone said that they couldn't remember which languages had semicolons as separators, and which as terminators. Prof said if you couldn't deal with that, you were gonna fail.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.