problem with if and else code... in ruby
Do not treat to the variables and conditions ...
def index
end
def search
count = 1
while count < 3
if count == 1
@movie = "not found" if @code1 == nil || @code1 == ""
if @movie == ""
end
end
if count == 2
@movie = "not found" if @code1 == nil || @code1 == ""
if @movie == ""
if @code1.include? "movshare"
end
if @code1.include? "novamove"
end
end
end
count++
开发者_Python百科end
end
end
what is the problem in this code? i get an error: syntax error, unexpected keyword_end
you have one more unnecessary 'end
'. There are 9 opening clauses including def, while and if
and 10 closing end
You are confusing the interpreter with your count++
. ++
does not exist in Ruby. You need to use count += 1
. The interpreter is probably assuming that is an expression involving addition, and expecting another operand but instead finding end
精彩评论