Hi -- On Sun, 13 Aug 2006, Neil Laurance wrote: > Hi there, > > Was hoping someone could point me in the right direction. I'm currently > learning a little ruby, and going through some of the puzzles from the > Ruby Quiz book. > > One of the examples uses a very strange looking construct: > [code] > a,b,c,d = *0 .. 3 > [/code] > As far as I understand this, *0 .. 3 equates to (0..3).to_a ? I've been > searching the online Ruby documentation, but couldn't find anwhere that > describes this syntax. Could anyone point me to a description for this? The * is the "unar[r]ay" (unary un-array) operator, or at least so-called by me :-) The construct you're talking about is indeed a little odd. It's one of the times when a range pretends to be an array. In fact, you don't need to un-array an array to get it to do parallel assignment: a,b,c,d = [0,1,2,3] So *0..3 is almost like saying: you're a range, but pretend that you're a thing that can be un-arrayed, namely an array. That seems to be the purpose of the * in this case -- to "trick" the range into thinking it's an array. If you look at ranges as array-like lists of values in the first place (which I don't), then it might make sense in a less convoluted way :-) David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.