I\'m trying to get user input and check if the user put in \"y\" or \"n\". Surprisingly, in the below code, neither the if nor the if else case exe
if
if else
You can use the chomp-nl crate which provides a chomp function which returns a string slice without the newline characters.
There is also a trait ChompInPlace if you prefer to do this in-place.
Disclaimer: I am the author of this library.