9. Next


#1


https://www.codecademy.com/en/courses/ruby-beginner-en-XYcN1/2/2?curriculum_id=5059f8619189a5000201fbcb

Oops, try again. Make sure to replace the ___s with the appropriate keywords! I don't understand why this code does not work and why certain formulas work and others don't - Please can you give examples?
Thank you

Mt code

i = 20
loop do
  i -= 1
  next if i/2=0
  print "#{i}"
  break if i <= 0
end


#2

Programming languages make promises about their behaviour, as long as you only rely on those promises in your code, your program will run.

But if you write something that languages do not promise to support, then what'll happen instead is that the code can't be executed, because there's nothing to support what you wrote.

Therefore you have to take care to only write things that make sense in the language.

I believe your code will result in an error message complaining about an unexpected = operator. It doesn't make sense there. Reconsider what you were doing and find out how to do that.


#3

Thank you for your response ionatan.

Sorry to bother you, buy would you have say 3 examples of good equations that can be used and 3 bad equations that would not work. So I can see the pattern in each?

Cheers

Brendan


#4

You're writing instructions, not equations.

There are lots of examples online, google for the thing that you want to see examples of, like assignment or testing whether two numbers are equal (and include the language's name in the search query obviously)


#5

A post was split to a new topic: Ruby not recognize the divide sign


#7