my first program just shuttin' down

R

Ruby Noob

Why? I tryin' to open the "hello.rb" program, but it just shuttin' down
why?
The hello.rb file, look's like this...

#!/usr/bin/ruby
print "Hello World"

and by the way... is methods like functions and object's in PHP? Could
some nice guy tell me the basic of methods, why it's important in Ruby
programmin' and so on.
 
S

Sam Rudd

[Note: parts of this message were removed to make it a legal post.]

I can't help with the title question, nor do I know the ins and outs of
Ruby, but I'm aware methods add functionality to classes.

Sorry I can't be any more help.
 
A

AzimuthDragon

For one thing, a proper Ruby script ends and terminates itself at the end of
the file if there were no errors. Use IRB instead to play with Ruby, or use
the command prompt and ruby helloworld.rb.

;)


You can also create a Windows command script if you wanted.
 
R

Ruby Noob

Cool, thanks a lot for the information, both of you. But if we sailing
over to the next question "What is method?" I've learn a lot of basic
method, i think like sort, max, reverse, length and so on. I got to know
more about it, thanks again / Ruby Noob
 
A

AzimuthDragon

Gladly, it's better to ask a question and be a fool for five minutes instead
of not asking and not letting us help. =)
 
D

David Masover

Cool, thanks a lot for the information, both of you. But if we sailing
over to the next question "What is method?"

A method is a function/subroutine which is associated with an object. In Ruby,
there are no functions/subroutines which are not methods.

For more than you probably ever wanted to know:

http://en.wikipedia.org/wiki/Method_(computer_science)

Otherwise, you probably want to start at the beginning -- pick up a Ruby book
(or tutorial, etc) which is targeted at non-programmers. If you don't know
what a method is, you're going to have to learn object-oriented programming
as you learn Ruby.
 
A

Axel Etzold

-------- Original-Nachricht --------
Datum: Mon, 9 Jun 2008 04:11:25 +0900
Von: David Masover <[email protected]>
An: (e-mail address removed)
Betreff: Re: my first program just shuttin\' down

A method is a function/subroutine which is associated with an object. In
Ruby,
there are no functions/subroutines which are not methods.

For more than you probably ever wanted to know:

http://en.wikipedia.org/wiki/Method_(computer_science)

Otherwise, you probably want to start at the beginning -- pick up a Ruby
book
(or tutorial, etc) which is targeted at non-programmers. If you don't know
what a method is, you're going to have to learn object-oriented
programming
as you learn Ruby.

Hi ---

if you want a nice online introduction into Ruby, I'd suggest Chris Pine's
Learn to Program (http://pine.fm/LearnToProgram/).
It teaches you Ruby from no pre-knowledge to using classes for a
small dragon in a game.
With respect to the shutting down part of your question: are you on Windows ?
It might be that your program runs nicely and quits without errors, but that
the window it runs in gets closed, as Windows routinely behaves like that.
You can try out irb in the one-click installer for Windows instead. Or you use
scite (I think it#s included with the one-click installer) or some other editor where you can run scripts in. Then you'll see the result in a special window.

Best regards,

Axel
 
R

Ruby Noob

Hello. Yeah, I did install the "Windows On-Click-Installer". In this
week i'll try to get a book, or hopely a good intrducin' to Ruby. If
your'e knowin' a good introducin' please tell me. This is the dummiest
question ever, but is ruby used for applications or websites? Wikipedia
didn't tell me so much.

I'll test the book you recommend.
 
J

jemminger

question ever, but is ruby used for applications or websites? Wikipedia
didn't tell me so much.

Both and more... You can write applications in wxRuby or RubyCocoa,
script your operating system with plain ruby, build websites in Rails
or Merb just to name a few.
 
R

Ruby Noob

I've started readin' that tutorial, you recommened it's really great! I
hope i will learn basic of Ruby this or next month, how long does it
take to get the basic?
 
D

David Masover

is ruby used for applications or websites?

First, that's a false dichotomy. (Wikipedia should explain that to you, if you
don't figure it out...) Websites can be considered applications, hence the
term "web application". Maybe you meant "desktop applications"?

Second, Ruby is Turing complete -- another phrase you can check Wikipedia for.
That means it can theoretically be used for anything. That's not unique to
ruby -- if it's not Turing-complete, it can't really be called a programming
language.

Practically, there's the limitation that Ruby is slower than most other
languages -- that's partly resolved in version 1.9, but I doubt Ruby will
ever be as fast as C.

But anything for which speed is not a factor, or for which more speed can be
obtained, you can use Ruby for. That covers almost any kind of program --
almost. Things like videogame engines are still mostly written in C/C++,
because they need to run as fast as they possibly can on whatever hardware
the gamer has available.
 
A

Axel Etzold

-------- Original-Nachricht --------
Datum: Mon, 9 Jun 2008 15:21:21 +0900
Von: Ruby Noob <[email protected]>
An: (e-mail address removed)
Betreff: Re: my first program just shuttin\' down
I've started readin' that tutorial, you recommened it's really great! I
hope i will learn basic of Ruby this or next month, how long does it
take to get the basic?

Dear John,

Ruby is the first language (and to this day the only one) in which I ever did something
that took less time than expected :)
If you have gone through that tutorial, you know the basics of the language ... that'll surely
take less than a month .. and for any particular questions, you can then go on to more encyclopaedic works like the Pickaxe book, the Ruby Cookbook or the Ruby Way:

http://pragprog.com/titles/ruby/programming-ruby
http://www.crummy.com/writing/RubyCookbook/
http://rubyhacker.com/

to name but a few ... and then, there is also this list.

Happy hacking,

Axel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,823
Latest member
Nadia88

Latest Threads

Top