Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 701 Bytes

File metadata and controls

49 lines (33 loc) · 701 Bytes

String and &str

Example

Execute the following command to run ./solutions/examples/string.rs

cargo run --example string

Exercises

Exercises are in ./exercises/src/lib.rs

Exercise 1

pub fn hello() -> String {
    todo!();
}

Create a function that returns the String "Hello Rust".

Exercise 2

pub fn greet(name: &str) -> String {
    todo!();
}

Create a function returns "Hello " appended with name.

Exercise 3

pub fn append(mut s: String) -> String {
    todo!();
}

Create a function that appends "!" to s.

Test

cargo test