diff --git a/book/src/06_ticket_management/01_arrays.md b/book/src/06_ticket_management/01_arrays.md index 68ddaf1..fb72c28 100644 --- a/book/src/06_ticket_management/01_arrays.md +++ b/book/src/06_ticket_management/01_arrays.md @@ -21,6 +21,15 @@ let numbers: [u32; 3] = [1, 2, 3]; This creates an array of 3 integers, initialized with the values `1`, `2`, and `3`.\ The type of the array is `[u32; 3]`, which reads as "an array of `u32`s with a length of 3". +If all array elements are the same, you can use a shorter syntax to initialize it: + +```rust +// [ ; ] +let numbers: [u32; 3] = [1; 3]; +``` + +`[1; 3]` creates an array of three elements, all equal to `1`. + ### Accessing elements You can access elements of an array using square brackets: