Ruby来自CodeAcademy的控制流在Ruby中敢于比较

Ruby来自CodeAcademy的控制流在Ruby中敢于比较,ruby,Ruby,我需要帮助,因为这不起作用。 它会给出一条错误消息: ruby:8:语法错误,输入意外结束,应为 确保在每个=!”后面都放一个表达式!。 运行: 什么意思 开始一个括号内的表达式Ruby中的所有内容都是一个表达式,然后有一个注释测试_1应该为false,然后是一个表达式测试_1=10

我需要帮助,因为这不起作用。 它会给出一条错误消息:

ruby:8:语法错误,输入意外结束,应为

确保在每个=!”后面都放一个表达式!。 运行:

什么意思

开始一个括号内的表达式Ruby中的所有内容都是一个表达式,然后有一个注释测试_1应该为false,然后是一个表达式测试_1=10<8,然后是一个内括号内的表达式,然后是注释测试_2=应该为false,等等。但是没有右括号,因此出现错误

这项工作:

(#) test_1 should be false
test_1 = 10 < 8

(#) test_2 = should be false
test_2 = 8 > 10

(#) test_3 = should be true
test_3 = 8 != 8 
)))
实际上你想做的是:

# test_1 should be false
test_1 = 10 < 8

# test_2 = should be false
test_2 = 8 > 10

# test_3 = should be true ????
test_3 = 8 != 8 

# test_4 = should be true
test_4 = 8 != 18

puts "test_1=#{test_1.inspect}"
puts "test_2=#{test_2.inspect}"
puts "test_3=#{test_3.inspect}"
puts "test_4=#{test_4.inspect}"

您应该键入的只是应该为false之后的部分,例如,您只需键入test1=10<8I就可以尝试,但仍然无法工作。ruby:8:语法错误,输入意外结束,希望您只需确保下面给出的语句是真是假
$ ruby -w t_op.rb 
t_op.rb:2: warning: assigned but unused variable - test_1
t_op.rb:5: warning: assigned but unused variable - test_2
t_op.rb:8: warning: assigned but unused variable - test_3
# test_1 should be false
test_1 = 10 < 8

# test_2 = should be false
test_2 = 8 > 10

# test_3 = should be true ????
test_3 = 8 != 8 

# test_4 = should be true
test_4 = 8 != 18

puts "test_1=#{test_1.inspect}"
puts "test_2=#{test_2.inspect}"
puts "test_3=#{test_3.inspect}"
puts "test_4=#{test_4.inspect}"
$ ruby -w t.rb 
test_1=false
test_2=false
test_3=false
test_4=true