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 trialsethedwards
1,141 PointsSorry for asking for help so much, it is just because I have tried everything to learn a programming language.
I really am having trouble with the elsif statement please help!
car_speed = 55
speed_limit = 55
if car_speed < speed_limit
too_fast = false
else
too_fast = true
end
elsif car_speed == speed_limit going_speed_limit = true
5 Answers
Polly Sileo
3,696 PointsHi. Just keep at it. We all get frustrated and stuck....that's part of being a programmer. It's pushing through that which will make you great.
Your structure needs too be If .... else if ...... else if .... ( you can have many of these) else
The else needs to be after all your else if. It's like you're telling the computer first try the if then try each else if in order if none of those work then do this last case senario - else
Else is if nothing else worked, it's a net for everything else that you didn't test.
Like if I was testing for a number I could say if 1 ...do something else if 2 .... do something else if 3 ....do something else if 4 ....do something else ....do something
So anything that isn't 1 - 4 will fall in that else category.
I hope that helps!
Maciej Czuchnowski
36,441 PointsBe brave :). And use a few resources at the same time. You can do free codecademy exercises simultaneously with Treehouse: http://www.codecademy.com/ - they have Ruby as well. And if you need some serious foundations for computer science and programming, you should definitely do Harvard's CS50 course, also free: https://www.edx.org/course/introduction-computer-science-harvardx-cs50x
sethedwards
1,141 PointsThank you all, you are so nice! :)
La Kenzi
14,346 Points@Sethewards, and Maciej, those are really great suggestions you made I currently use both of those sources. I'm taking the CS50 edx course again this year in hopes of finishing with everyone on time to receive a certificate. So again thanks for that and if you need any help along the way with these sources I would be more than happy to help in this journey.
Jim Withington
12,025 PointsAs folks are saying: no worries! The forums are here so that folks can get help!