The data type being compared was a GUID, which you can think of as a memory address. It's like saying if icecream == car, you can't really find a basis to compare them on.
However a string can have all the characters that a GUID has in it, but follows a strict set of rules which allows it to be compared. By using:
tostring(data) we turn it into a string, so when both of them are strings we can compare to see if they are the same.
If you are still unsure, google different data types (such as integers, booleans, floats and strings being the most common).