I am using the current function to make sure that none of the array elements start with specific 2 variables:
def checkDuplicates(x, y, array):
for l in array:
match l:
case [x, y]:
return False
case [x, y, _]:
return False
case other:
return True
and at some point, I had x as 1, y as 2, and l as [1,2]. There it matched the first case and returned false. However, when I used x as 1, y as 3 and l as [1,2], it for some reason changed y to 2 once it got to the first case statement, and didn't return True when it had to. Why could that be?
I learned about this concept on this website