object - What is [....] in Ruby? -
this question has reply here:
methods in ruby: objects or not? 5 answers what recursive arrays for? 2 answersended accidentally doing equivalent of in ruby other night:
class="lang-ruby prettyprint-override">a = *1..5 # => [1, 2, 3, 4, 5] << a # => [1, 2, 3, 4, 5, [...]] a.last # => [1, 2, 3, 4, 5, [...]]
what [...]
, can it?
it's way array.inspect displays recursive arrays. lastly element of itself. if displayed after 5, inspect end in endless loop:
[1, 2, 3, 4, 5, [1, 2, 3, 4, 5, [1, 2, 3, 4, 5, [1, 2, 3, 4, 5, [...]]]]]
ruby object
No comments:
Post a Comment