> Additionally, if the hash contains duplicate keys, swapping the keys and values may not have the desired effect.
You can't have duplicate keys in a hash.
More importantly, their implementation adds the swapped pairs but does not remove the original k/v pairs, which is both incorrect and does not match the output it prints.
> Additionally, if the hash contains duplicate keys, swapping the keys and values may not have the desired effect.
You can't have duplicate keys in a hash.
More importantly, their implementation adds the swapped pairs but does not remove the original k/v pairs, which is both incorrect and does not match the output it prints.