Better example for ownership transfer using String (#68)

* Better example for ownership transfer using String

* Update book/src/03_ticket_v1/06_ownership.md

---------

Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
This commit is contained in:
Keshav Chakravarthy 2024-05-28 14:38:34 +05:30 committed by GitHub
parent deb4ccb643
commit d77272a5b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -95,8 +95,8 @@ Ownership can be transferred.
If you own a value, for example, you can transfer ownership to another variable: If you own a value, for example, you can transfer ownership to another variable:
```rust ```rust
let a = 42; // <--- `a` is the owner of the value `42` let a = "hello, world".to_string(); // <--- `a` is the owner of the String
let b = a; // <--- `b` is now the owner of the value `42` let b = a; // <--- `b` is now the owner of the String
``` ```
Rust's ownership system is baked into the type system: each function has to declare in its signature Rust's ownership system is baked into the type system: each function has to declare in its signature