Hi I’m trying to make a blackjack game using Ruby and am trying to make the values of the picture cards all = 10. Is it okay to use the code I use below to accomplish this? (this is all happening in my Card class)
def value
if @number == ("jack" || "queen" || "king")
10
else
@number.to_i
end
end
You can, but not the way you are using it. You either need to use the entire boolean expression in each portion:
or you can make it simpler by checking the contents of an array: