Skip to content

Commit

Permalink
update primitives.md with example of array and tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
psyklopp committed Aug 25, 2024
1 parent 8f94061 commit afc67da
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/primitives.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ fn main() {
// Variables can be overwritten with shadowing.
let mutable = true;
/* Compound types - Array and Tuples */
// Array signature consists of Type T and length as [T; length].
let my_array: [i32; 5] = [1, 2, 3, 4, 5];
// Tuple is a collection of values of different types
// and is constructed using parentheses ().
let my_tuple = (5u32, 1u8, true, -5.04f32);
}
```

Expand Down

0 comments on commit afc67da

Please sign in to comment.