Ruby:'否则没有救援是没用的'错误的mssg

时间:2014-06-08 18:48:48

标签: ruby

我遇到了一个错误,我不明白所以我无法解决,我得到的错误信息是'其他没有救援是没用的',这是我的代码:

def land_plane!(plane)
    if @airport_contents.count = <5
        @airport_contents << plane
    else 
        puts "im full"
    end
end

任何帮助表示感谢。

1 个答案:

答案 0 :(得分:0)

看来你的代码并没有被ruby正确理解。尝试用下一个替换它:

def land_plane!(plane)
  if @airport_contents.count <= 5 
    @airport_contents << plane
  else 
    puts "im full"
  end
end