Start learning free

LESSON 41 OF 348 · FUNCTIONS I

Exercise: Create Function with Parameters in Rust in Rust

Practice

We've written this code:

fn main_function() {
	println!("My name is Andy");
	println!("I code in Python");
	println!("I have a dog");

	println!("My name is Mike");
	println!("I code in Java");
	println!("I have a cat");

	println!("My name is Sarah");
	println!("I code in JavaScript");
	println!("I have a parrot");
}

Write the same code in a better way by creating and calling a function with parameters print_messages()

STEP 1 OF 2
    Ctrl + Enter to check

    Exercise Create Function With Parameters in Rust

    Keep going with RustAbout 340 step-by-step lessons, from your first line of code to coding interviews. Free to start.
    Start learning free