From: John Gabriele Date: 2006-10-13T06:33:20+09:00 Subject: Ruby expressions vs. values (like Perl?) Does Ruby use the same terminology as Perl with regard to expressions versus values? I read a great MJD comment on PerlMonks a while back ( http://www.perlmonks.org/?node_id=72263 ). That comment notes how, in Perl, one needs to be well aware of the difference between expressions (the things you type into your code), and values (the things the interpreter evaluates expressions to). It seems that, the big reason for watching the difference between expressions and values in Perl is because expressions turn into different values at runtime depending upon context. So, back to Ruby, I believe that the rhs of the following statement is an "Array expression": irb(main):001:0> foo = ['a','bee','sea'] => ["a", "bee", "sea"] but, what kind of expression is the rhs of the following: irb(main):002:0> bar = 'dee', 'ee', 'eff' => ["dee", "ee", "eff"] ? Incidentally, I also note that this one -- although performing parallel assignment -- also happens to be generating an Array value: irb(main):003:0> zz = ( a, b, c = 'gee', 'aitch', 'aye' ) => ["gee", "aitch", "aye"] irb(main):004:0> zz => ["gee", "aitch", "aye"] According to irb, the Array gets generated even if you leave off the "zz =" and the parentheses. Seems like extra work for the interpreter to go through (making that Array), just to do a parallel assignment, no? Thanks, ---John