2 ms·
The program is semantically incorrect, the compiler or interpreter should complain that you are attempting to ask for equality of a string and a number, and it
by tialaramex 4y ago
The program is semantically incorrect, the compiler or interpreter should complain that you are attempting to ask for equality of a string and a number, and it doesn't know how to answer such a question. Then the programmer can fix the mistake.
Here's Rust for example:
error[E0277]: can't compare `&str` with `{integer}`
[The full diagnostic points to where exactly your code tries to perform such a comparison and explains that you could do this if PartialEq<{integer}> was implemented for &str, which it is not, and then suggests things which are PartialEq for &str, such as other strings and various string-like objects a sane person might compare them to]