Compares value with expected and replaces it with new value if values matches.
the old value
the expected value
the new value
Thanks for your feedback!