If statement with multiple conditions

Hi, I am pretty new to programming. What is the good way to write the
following condition.

def cart
if request.post and @cart.size < 10
puts “order accepted”
else
redirect_to :action => ‘list’
end
end

Katsuo I. wrote:

Hi, I am pretty new to programming. What is the good way to write the
following condition.

def cart
if request.post and @cart.size < 10
puts “order accepted”
else
redirect_to :action => ‘list’
end
end

That’s a perfectly reasonable way to write it.

Thanks Sebastian. It worked. What was I thinking?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs