Skip to content

Instantly share code, notes, and snippets.

@NevadaKiran
Created March 11, 2015 01:33
Show Gist options
  • Save NevadaKiran/3230146cbe26b0546aa7 to your computer and use it in GitHub Desktop.
Save NevadaKiran/3230146cbe26b0546aa7 to your computer and use it in GitHub Desktop.
# 1. assign the number 2015 to a variable named `this_year`
this_year = 2015
# 2. assign the number 2020 to a variable named `event_year`
event_year = 2020
# 3. calculate the difference in years and assign the value to `years_remaining`
years_remaining = event_year - this_year
# 4. use concatenation to create a message which reads:
# There are _ years until the big event.
message = "there are" + years_remaining.to_s + "years until the big event"
# 5. output the previous message, without a newline at the end
print message
# 6. output a newline
# 7. use interpolation to output the following message, ending with a newline:
# I can't wait until _ for the big event... Only _ years to go!
puts "I can't wait untl #{even_year} for the big event... Only #{years_remaining} years to go"
# Nice work! BONUS TIME!
#
# Don't worry at all if you don't finish these before class, you can go back and
# practice more later :)
# 8. create a list named `contact_info` with the following elements:
# * your name
# * your state
# * your zip code
# * number of years (or some number) you have lived in at your address
# 9. output the following message:
# Hello!
#
# My name is _. It's nice to meet you.
# I have lived in _ for _ years.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment