Borrowing a String

A better solution to the above problem is to modify greet to take a reference.

Exercise Get rid of the .clone() method call, and modify greet to accept a &String parameter. Then fix the calls to the greet function in main.

Get hands-on with 1000+ tech skills courses.

Learn to code, grow your skills, and succeed in your tech interview