One more example of why multiple numeric types

pull/22/head
Dhghomon 4 years ago committed by GitHub
parent 76ea9f792d
commit d46e8b7db9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -142,6 +142,14 @@ fn main() {
}
```
Here is another reason for the different sizes: `usize` is the size that Rust uses for *indexing*. (Indexing means "which item is first", "which item is second", etc.) `usize` is the best size for indexing because:
* An index can't be negative, so it needs to be a number with a u
* It should be big, because sometimes you need to index many things,
* But it can't be a u64 because 32-bit computers can't use that.
So Rust uses `usize` so that your computer can get the biggest number for indexing that it can read.
# Chars
A `char` is one character. For a `char`, use `''` instead of `""`.

Loading…
Cancel
Save