diff --git a/intro/01_basics/family.rb b/intro/01_basics/family.rb index b20700e..d0c8263 100644 --- a/intro/01_basics/family.rb +++ b/intro/01_basics/family.rb @@ -5,4 +5,8 @@ mary = 16 # Your code goes here +age_sum = mom + dad + john + mary +result = (mom * dad) / (john - mary) +puts "Sum of ages = #{age_sum}".reverse +puts "Result = #{result}".reverse diff --git a/intro/02_control_flow/.README.md.swp b/intro/02_control_flow/.README.md.swp new file mode 100644 index 0000000..2bfba4c Binary files /dev/null and b/intro/02_control_flow/.README.md.swp differ diff --git a/intro/02_control_flow/names.rb b/intro/02_control_flow/names.rb index e360f0d..658f1f3 100644 --- a/intro/02_control_flow/names.rb +++ b/intro/02_control_flow/names.rb @@ -5,4 +5,14 @@ name4 = "Melisandre" # Your code goes here +avg_length = (name1.length + name2.length + name3.length + name4.length) / 4 +print "What is your name?" +my_name = gets.chomp + + +if avg_length >= my_name.length + print "#{my_name} is shorter than average" +else + print "#{my_name} is shorter than average" +end