Created
November 10, 2017 20:02
-
-
Save yannis/ab6cd8c03e21ba0a9c693454d703ab77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby_girls = ['Ellen', 'Nadia', 'Yannis', 'Romina'] | |
p ruby_girls[1] | |
ruby_girls.sort.each do |ruby_girl| | |
puts ruby_girl | |
end | |
p 'let reverse it!' | |
ruby_girls.reverse.each do |ruby_girl| | |
puts ruby_girl | |
end | |
ellen = {age: 17, height: 170} | |
nadia = {age: 18, height: 168} | |
rails_girls = [ellen, nadia] | |
total_height = 0 | |
rails_girls.each { |rg| total_height += rg[:height] } | |
p total_height | |
average_height = total_height / rails_girls.size | |
p average_height |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment