Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unused_variables)]
- fn main() {
- // Declare using type inference
- let months = ["January", "February", "March", "April", "May", "June", "July",
- "August", "September", "October", "November", "December"];
- // Or annotate the type--note that the length of the array is part of the type.
- let a: [i32; 5] = [1, 2, 3, 4, 5];
- let b = a[0];
- // out of bounds!
- let c = a[10];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement