Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-cacio authored Oct 9, 2018
1 parent f18ac46 commit 1271ec8
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,30 @@

#### Emscripten
#### wasm-rust

### Rust
Two out of three (ain't bad) key concepts of the language:
- ownership
example:
```rust
fn print_vec(vec: Vec<i32>) {
println!("{:?}", vec);
}

fn main() {
let vec = vec![1, 2, 3, 4];
print_vec(vec);
print_vec(vec);
}
```
- borrowing
```rust
fn print_vec(vec: &Vec<i32>) {
println!("{:?}", vec);
}

fn main() {
let vec = vec![1, 2, 3, 4];
print_vec(&vec);
print_vec(&vec);
}

0 comments on commit 1271ec8

Please sign in to comment.