R
Ruby Student
[Note: parts of this message were removed to make it a legal post.]
Team,
Is there a quick (perhaps one liner) way to initialize the following hashes
into just one hash?
def xwing(ia)
p ia
puts " "
p @xwing
r1 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r2 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r3 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r4 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r5 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r6 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r7 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r8 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r9 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
end
(0..8).each do |r|
xwing(@xwing[[r][0]]) # @xwing is defined previously
end
Actually, I wanted just one hash, @frequency, but I did not know how to do
it.
Thank you
Ruby student
Team,
Is there a quick (perhaps one liner) way to initialize the following hashes
into just one hash?
def xwing(ia)
p ia
puts " "
p @xwing
r1 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r2 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r3 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r4 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r5 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r6 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r7 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r8 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
r9 = {"1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" =>
0, "8" => 0, "9" => 0}
end
(0..8).each do |r|
xwing(@xwing[[r][0]]) # @xwing is defined previously
end
Actually, I wanted just one hash, @frequency, but I did not know how to do
it.
Thank you
Ruby student