The relational operators

In the following code, Rust-Lang check the ASCII code of the characters?

fn main() {

Thank you.

Sort of. It compares the UTF8 bytes. In this case the strings both consist of one UTF8 byte corresponding to ASCII.

But the general comparison is more general.

1 Like

The ASCII code of A is 65 and a is 97, then 65<97.
Am I right?

Yes (because UTF8 is a superset of ASCII).

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.