Swift - Operators and Expressions
Which of the following Swift statements correctly tests if two class instances
x and y are the same object?x and y are the same object?=== to check if two references point to the same instance.=== correctly. if x == y { print("Same instance") } uses == which checks value equality, not identity. if x = y { print("Same instance") } is an assignment, not a comparison. if x !== y { print("Same instance") } checks inequality, not equality.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions