Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDaniel Ahmadizadeh
1,979 PointsHow come the name variable is in a string but the year variable can just be in "puts" ?
In the video you can see that Jason puts a variable in the string and then a variable in puts. I was wondering why that can be done.
Thanks!
1 Answer
Salman Akram
Courses Plus Student 40,065 PointsHi Darian,
I see what you mean but you don't have to follow what Jason's instruction, we can be very creative to create our own variable name and string for us to read easier than Jason's methods, whatever you can play around a bit.
Here's better way:
name = "Jason"
puts "My name is #{name}."
year = 2014
puts "The year is #{year}."
or
name = "Jason"
year = 2014
puts "My name is #{name} and year is #{year}."
Hope that helps. ;)
Daniel Ahmadizadeh
1,979 PointsDaniel Ahmadizadeh
1,979 PointsThank you so much!