Let me start by saying I hate nothing more in the world then trying to learn a coding language by reading a PDF. It's slow and inefficient and I don't fucking learn anything. All they ever do is just show you a thousand examples for you to copy and see the result, which, they show you in the book. It sucks. I hate it. Goddamnit.
But, you need to learn the very basics somehow and I don't really see another way. People say that you should just start a tiny project and that's the best way to learn. Well, that doesn't exactly work if you know absolutely nothing about the language constructs and data types and whatnot. So, seems you have to learn it from a fucking book. The other thing I hate, is that there seems to be no such fucking thing as a coding book that actually teaches you the up to date language. It's always a book written in the early 2000's which is 10 versions old. Normally it's not a huge problem, but I think I might be having that problem right now. Here's an example. I'm reading the "Learning Ruby" pdf to get the very basic basics down before I start just trying to code something. Now, this little snippet:
#!/usr/bin/ruby
lang = :fr
dog = case lang
when :en: "dog"
when :es: "perro"
when :fr: "chien"
else "dog"
end
Is taken from the book. I tried making it my own at first but got unexpected errors, so I just copy pasted directly as a test and sure enough, it still didn't work. I get this error:
case.rb:6: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
when :en: "dog"
^
case.rb:7: syntax error, unexpected keyword_when, expecting end-of-input
when :es: "perro"
Ruby 2.1 doesn't seem to like :'s. I've gotten the same error when trying to do this:
if lang == :en: puts 'dog'
elsif lang == :es: print 'perro'
....
So how the fuck am I supposed to learn a language, from a pdf, which is incorrect? It's such a fucking unfun and poor/slow learning process. Makes me hate coding.
EDIT: Oh, and as a side note, it really fucking sucks that the vast majority of resources out there for Ruby are strictly Ruby on Rails. That's it. That's the only fucking reason anyone wants to learn Ruby ever. Ruby on Rails. I wanted to learn Ruby because I wanted a fairly simple general purpose scripting language that wasn't Python. I generally dislike web dev. I just want to learn fucking Ruby.