我开始学习
Ruby,需要一些帮助包括?方法.
以下代码工作正常:
x = 'ab.c' if x.include? "." puts 'hello' else puts 'no' end
但是当我这样编码的时候:
x = 'ab.c' y = 'xyz' if x.include? "." || y.include? "." puts 'hello' else puts 'no' end
当我运行它时给我错误:
test.rb:3: Syntax error,unexpected tSTRING_BEG,expecting keyword_then or ';' o r '\n' if x.include? "." || y.include? "." ^ test.rb:5: Syntax error,unexpected keyword_else,expecting end-of-input
谢谢