Advertisement
cwchen

[Rust] Retrieving data from a slice with indexs.

Aug 22nd, 2017
727
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.13 KB | None | 0 0
  1. fn main() {
  2. let slice = &[1, 2, 3];
  3.  
  4. assert_eq!(slice[0], 1);
  5. assert_eq!(slice[1], 2);
  6. assert_eq!(slice[2], 3);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement