stephen.tashiro
3/22/2006 4:59:00 PM
Would someone explain the syntax of nested blocs vis-a-vis the use of
Array.each ?
I thought that 'lname' would be an element of an Array in the program
below. But the interpreter (ruby-1.8.4-1.fc3 in Fedora Core 3) tells
me it is the entire Array.
first_name = Array.[]( "Joe ","Albert ","Lilly ","Henry ","Becky
","Ray ")
last_name = Array.[]( "Groster", "Riplaid", "Pewley", "Lundrund",
"Banks" }}
tmp_name = "long string of nothing"
first_name.each { |fname|
last_name.each { |lname|
tmp_name = fname
# tmp_name = fname + lname # This produces a syntax error
# puts(tmp_name)
puts( lname.inspect)
}
}