From: pjb@... (Pascal J. Bourguignon) Date: 2009-06-18T18:35:12+09:00 Subject: Re: I need help learning Ruby; completely lost! Kaleb Mccamish writes: > I need help. I need to learn some basics of programming, and was turned > on to Ruby by a friend. So I bought a book about it, installed Ruby and > Vim, sat down and made a tiny little Ruby program that should print out > "Hello, Matz!" > > But, it doesn't. > > I saved it as a .rb file, double clicked it hoping to see my very first > program in any language EVER come to life, and... A command prompt-like > window opened for a split second, closed, and nothing happened. > > Where oh where did I go wrong? Do I need this "Rake" program to use .rb > files? Is it a problem with Vim? Probably. ;-) I use emacs. > Please help, I'm so confused I don't > know what to do! Launch irb from a terminal: [pjb@host :0.0 ~]$ irb Pascal, Welcome to the IRB! irb(main):001:0> printf "Hello Matzacrer!\n" Hello Matzacrer! => nil irb(main):002:0> def f(x) irb(main):003:1> if (x==1) irb(main):004:2> 1 irb(main):005:2> else irb(main):006:2* x*f(x-1) irb(main):007:2> end irb(main):008:1> end => nil irb(main):009:0> f(15) => 1307674368000 irb(main):010:0> quit [pjb@host :0.0 ~]$ It's easier to learn the language when you can try out expressions interactively. You may edit them in your editor and copy-and-paste to the irb window, or if you use emacs, you can have the editor send the expression you typed in the source file to the irb process. Perhaps vim can do it too. -- __Pascal Bourguignon__