What does this mean?

def cas
casses = [@cas.ss,@cas.s,@cas.xl,@cas.l,@cas.m,@cas.w,@cas.xw]
casses.each do |cas|
if cas >= 10
@user.send(cas) -= 1
@user.save!
end
end

my error:
app/controllers/battle_controller.rb:383: parse error, unexpected
tOP_ASGN, expecting kEND
@user.send(cas) -= 1
^
app/controllers/battle_controller.rb:388: parse error, unexpected $,
expecting kEND

You’re missing an end. You should have three ends, one for the if,
one for the do, one for the def.

def cas
casses = [@cas.ss,@cas.s,@cas.xl,@cas.l,@cas.m,@cas.w,@cas.xw]
casses.each do |cas|
if cas >= 10
@user.send(cas) -= 1
@user.save!
end
end
end

Michael

Michael T. wrote:

You’re missing an end. You should have three ends, one for the if,
one for the do, one for the def.

def cas
casses = [@cas.ss,@cas.s,@cas.xl,@cas.l,@cas.m,@cas.w,@cas.xw]
casses.each do |cas|
if cas >= 10
@user.send(cas) -= 1
@user.save!
end
end
end

Michael

That got rid of the bottom part but I still have a problem with
@user.send(cas) -= 1

Mohammad, you wrote,

end

end
end

Michael

That got rid of the bottom part but I still have a problem with
@user.send(cas) -= 1

This probably is caused because the send method on your @user class is
not a
valid LHS, so you cannot assign to it.