D
Daniel Amelang
And you'll have to agree that that won't work.
Yes, with the current state of Ruby, you are right. But let's travel
back and take another look at matz's original idea: introducing _true_
multiple return values. With this change, the following methods will
no longer be equivalent:
def get_array
return [1,2]
end
def get_mult_values
return 1, 2
end
If we had true multiple return values (as part of the language), we
could then use the methods like this:
a = get_array # [1,2]
a = get_mult_values # 1
a, b = get_mult_values
This was what he meant in the first place by 'true multiple return
values'. I, personally, find it cleaner than having 3 methods for each
bang method (strip, strip!, strip!?) and it has potential for other
uses.
Although I _really_ want to write a 'what!?' method someday
Dan
Yes, with the current state of Ruby, you are right. But let's travel
back and take another look at matz's original idea: introducing _true_
multiple return values. With this change, the following methods will
no longer be equivalent:
def get_array
return [1,2]
end
def get_mult_values
return 1, 2
end
If we had true multiple return values (as part of the language), we
could then use the methods like this:
a = get_array # [1,2]
a = get_mult_values # 1
a, b = get_mult_values
This was what he meant in the first place by 'true multiple return
values'. I, personally, find it cleaner than having 3 methods for each
bang method (strip, strip!, strip!?) and it has potential for other
uses.
Although I _really_ want to write a 'what!?' method someday
Dan