B
Bruce F.
I'm a newcomer to Ruby, and I'm confused about what executable
statements which are in a class definition, but not explicitly in a
method, mean. How are they executed? I assume that there's an implicit
method that they define; is that right?
The most obvious example is the one-line program:
puts "Hello, World!"
Since there's no explicit class definition, I understand that it's in an
automatically generated class (main). But, what method of that class is
it in? And, if it were an explicit class, how would I execute it?
(Apparently it's executed automatically if it's in main.)
Thanks,
Bruce
statements which are in a class definition, but not explicitly in a
method, mean. How are they executed? I assume that there's an implicit
method that they define; is that right?
The most obvious example is the one-line program:
puts "Hello, World!"
Since there's no explicit class definition, I understand that it's in an
automatically generated class (main). But, what method of that class is
it in? And, if it were an explicit class, how would I execute it?
(Apparently it's executed automatically if it's in main.)
Thanks,
Bruce