I have to check if my variable idx is in the range between 0 and 8 (both 0 and 8 should be included)
The following comparison works idx<=8 && idx>=0
But I would like to use the dotted syntax instead idx === (0…8) - however it doesn’t work
I was wondering if anybody can see any difference between the two
Below is my function as I am using it in my program
def valid_move?(board, idx)
idx<=8 && idx>=0 &&!(position_taken?(board,idx))
end
vs
def valid_move?(board, idx)
idx === (0..8) && !(position_taken?(board,idx))
end