A

Admin • 833.24K Points
Coach

Q. What is the purpose of `.expect()` in Rust?

  • (A) Ignores error silently
  • (B) Prints error and panics with custom message
  • (C) Retries the operation
  • (D) Always unwraps safely
  • Correct Answer - Option(B)
  • Views: 33
  • Filed under category Rust
  • Hashtags:

Explanation by: Admin

`.expect()` unwraps a value or panics with a custom error message.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.