Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Basics Conditionals "if" Statements

Saadia Fattah
Saadia Fattah
1,939 Points

I did everything the directions said, but it said this what does that mean?

Bummer: /workdir/program.rb:11: warning: found = in conditional, should be == /workdir/program.rb:12:in <top (required)>': uninitialized constant OK (NameError) from task_1.txt:2:inrequire_relative' from task_1.txt:2:in `<main>

program.rb
check_speed = 55 

if check_speed > 100
  puts too fast 
end 

if check_speed < 55
  puts too slow 
end 

if check_speed = 55
  put speed OK
end 

1 Answer

Rogier Nitschelm
seal-mask
.a{fill-rule:evenodd;}techdegree
Rogier Nitschelm
iOS Development Techdegree Student 5,461 Points

You should use == for comparison, not =. Like I stated before, = is used for variable assignment.

if check_speed = 55 # this is incorrect, you are assigning and not comparing
if check_speed == 55 

There is another problem however. Strings need to be enclosed in quotes or double quotes. Which is what it is complaining about.

puts "speed OK"
Saadia Fattah
Saadia Fattah
1,939 Points

I don't understand I corrected those mistakes, but it still says its wrong why?

Saadia Fattah
Saadia Fattah
1,939 Points

nvm forgot something