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
Rogier Nitschelm
iOS Development Techdegree Student 5,460 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