Skip to content

Commit 859786c

Browse files
authored
Merge pull request #1878 from psyklopp/master
Update primitives.md with examples
2 parents 8f94061 + 7bf3ae8 commit 859786c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Rust By Example
22

3-
[![Build Status][travis-badge]][travis-repo]
4-
5-
[travis-badge]: https://travis-ci.com/rust-lang/rust-by-example.svg?branch=master
6-
[travis-repo]: https://travis-ci.com/rust-lang/rust-by-example
3+
[![Build Status](https://github.com/rust-lang/rust-by-example/actions/workflows/rbe.yml/badge.svg)](https://github.com/rust-lang/rust-by-example/actions)
74

85
Learn Rust with examples (Live code editor included)
96

src/primitives.md

+9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ fn main() {
4949
5050
// Variables can be overwritten with shadowing.
5151
let mutable = true;
52+
53+
/* Compound types - Array and Tuple */
54+
55+
// Array signature consists of Type T and length as [T; length].
56+
let my_array: [i32; 5] = [1, 2, 3, 4, 5];
57+
58+
// Tuple is a collection of values of different types
59+
// and is constructed using parentheses ().
60+
let my_tuple = (5u32, 1u8, true, -5.04f32);
5261
}
5362
```
5463

0 commit comments

Comments
 (0)