Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created August 21, 2019 01:03
Show Gist options
  • Select an option

  • Save harrisonmalone/8b68d445e285c0f9ea2bed876ba7d7b8 to your computer and use it in GitHub Desktop.

Select an option

Save harrisonmalone/8b68d445e285c0f9ea2bed876ba7d7b8 to your computer and use it in GitHub Desktop.
# 1. Make two variables called name and age. Assign them values, e.g. name = "bob" age = 20. Use string interpolation to print "My name is Bob and I am 20 years old".
# string
name = "Bob"
# integer
age = 20
p "My name is #{name} and I am #{age} years old"
# 1. p
# 2. puts
# 3. print
# 2. Here are two variables: x = 2, y = 3; Use string interpolation to print to screen: "The result of adding x to y is 5".
x = 2
y = 3
p "The result of adding x to y is #{x + y}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment