You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-15 22:00:26 +02:00
Updates PR with code formatting
Backticks for inline and single line code blocks / examples.
This commit is contained in:
@ -36,14 +36,20 @@ Arrays:
|
||||
*We can use literals to assign values to arrays.
|
||||
|
||||
*Demonstrate out of bounds errors by setting n to different values
|
||||
e.g. a[n+15] = 11 // index out of bounds error since len is 10
|
||||
|
||||
```
|
||||
a[n+15] = 11 // index out of bounds error since len is 10
|
||||
```
|
||||
|
||||
*Efficient way to check n is in bounds:
|
||||
assert!(n+20 < a.len()); // panics
|
||||
|
||||
```
|
||||
assert!(n+20 < a.len()); // panics
|
||||
```
|
||||
|
||||
*In the main function, the print statement contains the debug implementation {a :?}.
|
||||
|
||||
*Adding #, eg {a:#?}, invokes a "pretty printing" format, which can be easier to read.
|
||||
*Adding `#`, eg `{a:#?}`, invokes a "pretty printing" format, which can be easier to read.
|
||||
|
||||
Tuples:
|
||||
|
||||
|
Reference in New Issue
Block a user