Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #![allow(unused_variables)]
  2.  
  3. fn main() {
  4. // Declare using type inference
  5. let months = ["January", "February", "March", "April", "May", "June", "July",
  6. "August", "September", "October", "November", "December"];
  7.  
  8. // Or annotate the type--note that the length of the array is part of the type.
  9. let a: [i32; 5] = [1, 2, 3, 4, 5];
  10.  
  11. let b = a[0];
  12.  
  13. // out of bounds!
  14. let c = a[10];
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement