Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Best way to learn proper Syntax in Ruby

I'm working through the Ruby Development Track, and have been practicing writing code in irb. Programming is new to me.

I've noticed I often make syntax errors when coding. Usually, it's something "minor" but prevents my code from executing. For example, I might forget to close curly braces or forget to do some other syntax related thing. I'm learning to decifer the Ruby error messages. Ruby has been helpful after-the-fact.

Other times, I start to practice writing say a method or loop, but forget the proper syntax! I realize Ruby is fairly lenient when it comes to syntax. Still, my question is this:

  * Are there convenient "cheat sheets" on Ruby syntax?
  * Is there an efficient way to "remember" Ruby syntax?  

In the real world, how do programmers remember this syntax stuff? Is it something you just get used to (i.e., becomes second nature)? If that's the case, how did you handle this "hurtle" when you first started? I'd appreciate any feedback, observations, or advice.

Thanks!

Ronald

Thanks Maciej,

I'll check out what Code Academy has to offer. I'm familiar with Code SCHOOL. I'm currently taking a free Ruby course from them. Code School's offers a lot of code practice in irb. I really like that aspect of Code School's approach to teaching Ruby to newbies.

Best,

Ronald

2 Answers

Hey Ronald Jackson,

Personally I would recommend a good Ruby book that covers pretty much everything.

Reading a book can help things sink in, along with typing what you learn into the irb.

Also, something that I really recommend is to learn in stages (something that books do well) and once you have learnt something new, try and build a simple project that makes use of that new technology.

I recommend the book that I read for Ruby, a free PDF of the book can be found here: Beginning Ruby Book

Hi John!

Thanks for the recommendation of the book. I'll check it out at my earliest opportunity. The more I practice writing code, the more I understand the concepts. Listening to videos is good, reading books is good, but actually doing is best. My learning seems to kick start when I actually try to write a program using the knowlege gleaned from the video lessons.

Thanks again, and good luck to you in your journey too.

Best regards,

Ronald

No problem Ronald Jackson,

Good luck with learning Ruby. Also please make sure you assign credit for good answers on this question and any others you post to the Treehouse forum.

Thanks

Hi again, John,

I checked out the online book you recommended: Beginning Ruby! I sampled parts that address hashes and methods ... very good explanations. I really liked how the author breaks down his code examples, and explains what each piece of code does. Helpful to see the syntax and substance. I plan to read the entire book as I complete the Ruby/Rails track. It's a basic book, but "basic" is exactly what I'm looking for right now. Thanks again for recommending the resource.

Both answers to my post were very helpful. However, for the basic Ruby book reference, I rated yours "best."

Ronald

I'd say practice as much as possible and sooner or later it will become your second nature, you will also quickly find your mistakes the more errors you make. Same thing goes for Rails once you get to that part - it will be overwhelming at first (since it's the whole structure of Rails apps, erb syntax, rspec and capybara, git etc.) and you will make a TON of mistakes, but be patient and in time it will all become natural to you. You need a lot of practice, I don't know any other method :). You can practice more here: http://www.codecademy.com/en/tracks/ruby

+1 on this answer