<<<<<<< HEAD
Exercises to grasp and practice fundamental concepts in Ruby.
Hashes have keys and values, and we can look up values easily if we have the key. (The inverse is not necessarily true.).
Strings are everywhere. Let's munge them a bit.
More string stuff.
def test_loop_in_array
people = ["Alice", "Bob", "Charlie"]
# wants one block parameter
people.each do |person|
person.inspect
end
enddef test_loop_in_hash
people = {"Annie" => 39, "Jim" => 10, "Barney" => 12}
# wants two block parameters
people.each do |name, age|
"#{name} is #{age} years old"
end
end=======
Sometimes we want to get information about something. Is it Wednesday? How many people have signed up to attend the event? Which channel is your favorite? Asking the question doesn't change anything. It's either Wednesday or it isn't, and asking the question doesn't make it Thursday.
Other times, we do something to the world, and something changes. We throw something in the trash. Now the trash can has more stuff in it. We buy a drink. Now we have less money.
In many software systems we try to keep a clear separation between obtaining data and changing things. When we're asking about something, we don't change things, and when we change things, we don't get information back. If, when we've told the system to change, we want to know whether or not anything actually happened, or what the new situation is, we'll have to go ask.
These exercises focus on these two types of operations.
leather_chair_test.rbpills_test.rbfloor_test.rbmilk_bottle_test.rbperson_test.rbdoor_test.rbteeth_test.rbmusic_test.rbdrops_test.rblight_test.rbbaby_test.rbkid_test.rbbeers_test.rbteenager_test.rbadult_test.rbnames_test.rbdog_test.rbwater_test.rbappointments_test.rbyak_test.rbstudent_test.rbmoney_test.rbtime_test.rbchildren_test.rbcatalogue_test.rb
... and submit pull requests
ebfe1214d1d209b2c6523348ce44bc1eb2a71165