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 trialAlicja Dul
8,589 PointsChallenge task 1 of 1 => We expected the "integer" variable to equal 123, but it was: nil
Hello,
Someone can help me?
Regards
string = "123"
def int
integer = string.to_i
end
def float
float = string.to_f
end
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! You're doing just fine, but the def
keyword is used to define methods/functions. Because the challenge has not asked for any user-defined methods or functions, it does not know to look for them so it can't see the variables you've made. If you remove the def
and end
lines from around your variables, your code passes with flying colors!
Hope this helps!
Alicja Dul
8,589 PointsThanks a lot!