R
Robert Dober
Hi list I was just thinking it might fun to present some of Ruby's
features in form of a riddle.
There was an interesting thread yesterday and as I always forget the
basics I wrote some testcode to find out if the local or the method
prevails, I made a stupid
error and had to rewrite the code, or maybe did I not? This depends on
the answer of the riddle.
Todays Ruby Riddle is:
Can the following code be used to test if the argument of puts is the
local variable "a" or the method "a"? And if so please explain how.
<code>
a = 42
def a; 42 end
puts a
</code>
I leave some blank lines here so that people can reply without
spoiling if for other readers.
features in form of a riddle.
There was an interesting thread yesterday and as I always forget the
basics I wrote some testcode to find out if the local or the method
prevails, I made a stupid
error and had to rewrite the code, or maybe did I not? This depends on
the answer of the riddle.
Todays Ruby Riddle is:
Can the following code be used to test if the argument of puts is the
local variable "a" or the method "a"? And if so please explain how.
<code>
a = 42
def a; 42 end
puts a
</code>
I leave some blank lines here so that people can reply without
spoiling if for other readers.