Question: Ruby programming language Is there a way where I could access a hash from one method in another method? In this case, I'm trying to

Ruby programming language

Is there a way where I could access a hash from one method in another method? In this case, I'm trying to access the 'hash' hash from the 'add' method in the 'entries' method. That is where I want the entries method to display whatever hash (from the add method) has inside of it.

PS: If you have the time, please explain why the program displays numbers when I ask it to display the 'entries' method

Ruby programming language Is there a way where I could access a

main.rb saved 1 hashHash.new 3 def add (hash) ruby 2.5.0p0 (2017-12-25 revision 61468) [x86 6 linux] 2656131272737232804 => nil 4 end 6 def entries return hash 8 end 9 10 add("sds" >"sdsd" 11 puts entries 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!