# I need help learning Ruby; completely lost!

**URL:** <https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485>\
**Category:** Ruby\
**Created:** [June 18, 2009, 2:38am UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485 "2009-06-18T02:38:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 2:38am UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/1 "2009-06-18T02:38:51Z")

</div>

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? Please help, I’m so confused I don’t  
know what to do!

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 2:59am UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/2 "2009-06-18T02:59:54Z")

</div>

On Jun 18, 2009, at 2:38 AM, Kaleb M. wrote:

> 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.

It does ;).

> 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.

Thats no error in your program - thats how the windows command prompt  
behaves:  
it closes right after the program finishes. As just printing one line  
is really  
quick, you only see a glimpse of it.

So, you have multiple options. Either you open the command prompt by  
hand (Start  
-\> Execute -\> “cmd”), navigate to the folder where your program is and  
type:

ruby programname.rb

Another option is to add “gets” at the end of your program, like this:

puts “Hello, Matz!”  
gets

This makes the program wait for input. It will close once you press  
Enter.

> Where oh where did I go wrong? Do I need this “Rake” program to  
> use .rb  
> files? Is it a problem with Vim? Please help, I’m so confused I don’t  
> know what to do!

I hope I cleared the confusion. Welcome to the list!

Regards,  
Florian

–  
Florian G.

smtp: removed\_email\_address@domain.invalid  
jabber: removed\_email\_address@domain.invalid  
gpg: 533148E2

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 4:06am UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/3 "2009-06-18T04:06:27Z")

</div>

Thanks Mr(s?). Gilcher! Adding “gets” to the end does the trick!

I suppose since my initial problems have been rectified, I’ll use this  
thread for any future problems. Saves energy, and cuts down on spam!

Thanks again!

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 10:54am UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/4 "2009-06-18T10:54:52Z")

</div>

Kaleb M. wrote:

> Thanks Mr(s?). Gilcher! Adding “gets” to the end does the trick!
> 
> I suppose since my initial problems have been rectified, I’ll use this  
> thread for any future problems. Saves energy, and cuts down on spam!
> 
> Thanks again!

If you’re starting off dabbling, you might prefer to use IRB. You can  
see everything that’s going on then.

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 11:35am UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/5 "2009-06-18T11:35:37Z")

</div>

Kaleb M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> 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.

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 3:28pm UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/6 "2009-06-18T15:28:13Z")

</div>

On Thu, Jun 18, 2009 at 7:36 AM, Kaleb M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I suppose since my initial problems have been rectified, I’ll use this  
> thread for any future problems. Saves energy, and cuts down on spam!

Please don’t do that - it’s just confusing. Post one thread per topic,  
and keep the subject line relevant to that specific problem; that way,  
you’re both more likely to get answers, and other people who have the  
same issues will know to read the thread.

martin

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 3:37pm UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/7 "2009-06-18T15:37:39Z")

</div>

Martin DeMello wrote:

> On Thu, Jun 18, 2009 at 7:36 AM, Kaleb M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I suppose since my initial problems have been rectified, I’ll use this  
> > thread for any future problems. Saves energy, and cuts down on spam!
> 
> Please don’t do that - it’s just confusing. Post one thread per topic,  
> and keep the subject line relevant to that specific problem; that way,  
> you’re both more likely to get answers, and other people who have the  
> same issues will know to read the thread.

And Google first!

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 3:01pm UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/8 "2009-06-18T15:01:25Z")

</div>

Mike S. wrote:

> If you’re starting off dabbling, you might prefer to use IRB. You can  
> see everything that’s going on then.

If you used the One Click Installer, it came with Scite. Just type in a  
program  
and tap F5.

---

<div class="post-metadata">

**Author:** ![kalebmcc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@kalebmcc](https://www.ruby-forum.com/u/kalebmcc)\
**Post date:** [June 18, 2009, 5:16pm UTC](https://www.ruby-forum.com/t/i-need-help-learning-ruby-completely-lost/170485/9 "2009-06-18T17:16:10Z")

</div>

I like using netbeans. [http://www.netbeans.org/](http://www.netbeans.org/) It is made by Sun and  
has a lot of cool built in stuff for ruby. It has a window for the  
output so you can see the results easily. It is free.
