我的解决方案在这里是否正确? CodeAcademy返回以下错误:"哎呀,再试一次。确保你的“如果'声明仍然具有相同的行为。它应该放一个不到两个!'
if 1 < 2
puts "One is less than two!"
else
puts "One is not less than two."
end
# My Solution
# 1 < 2 ? "One is less than two!" : "One is not less than two"
答案 0 :(得分:0)
试试这个
puts "One is less than two!" if 1 < 2 : "One is not less than two."
答案 1 :(得分:0)
就是这样:
puts 1 < 2 ? "One is less than two!" : "One is not less than two."
你从布尔语句开始然后由于一些奇怪的原因,put首先出现(不是真的理解那背后的逻辑但是好)然后你这样做,如果它是真的,结果处理然后这样做,如果是假的。