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 trial

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