4. Arrays of Arrays


What exactly \n stands for as it shown below?
multi_d_array.each { |x| puts “#{x}\n” }


Hi the \n stand for newline in this case all the thing you will print will be print each one on its line.


Thanks for the answer. Why there is puts then, not print? I thought that was the difference between puts and print.


i’m wondering about that too…isn’t puts enough for this?
i hope someone clear this for us


Hey, yo may not see the difference in your example, but see another exercise about hashes,
secret_identities = {
“The Batman” => “Bruce Wayne”,
“Superman” => “Clark Kent”,
“Wonder Woman” => “Diana Prince”,
“Freakazoid” => “Dexter Douglas”

secret_identities.each {|name, lastname |puts “#{name}: #{lastname}\n”}

You can put the \n in the middle “#{name}:\n #{lastname}\n” and you will see it in another line.
So puts place what is inside the “” in other line, with \n you can put inside the “”


Hi sorry for the long answer, the difference between them you could read it here @betasolver23509 @a7lamlover