I need to create a method which should receive as argument only an array of numbers between 1 and 6. If the argument is something different I want to exit the method with an error message.
What method score(dice) does is explained here
I thought of using a double conditional clause such as:
if (dice.is_a? Array ) && ("elements of dice are numbers of range (1..6)")
do something
else print "error message"
In place of the string "element of dice are numbers of range (1..6)" I tried the following code but does not work:
dice.each { |num| num <= 6 }
What would you suggest?