I was working on a POC and as a process of which I ran into a weird issue of comparing two strings differently gives different results. I might be missing something simple but wanted to see if there is really a difference. Following is the piece of code I'm executing anonymously.
string a = 'Cancel'; string b = 'Cancel'; system.debug(' sample test:'+ a == b); system.debug(a == b);
I expected to get the same results since the comparison I'm doing is the same. The only difference is I'm using a debug identifier and not an identifier in the second log.
Results: system.debug(' sample test:'+ a == b); -- false system.debug(a == b); -- true
Am I missing anything here?