R

Ravina • 3.96K Points
Extraordinary

Q. Which syntax is correct for a function returning a Result?

  • (A) fn my_func() -> Result<String, i32>
  • (B) fn my_func() -> Option<String>
  • (C) fn my_func(String) -> Error
  • (D) fn my_func(Result)
  • Correct Answer - Option(A)
  • Views: 7
  • Filed under category Rust
  • Hashtags:

Explanation by: Ravina
`Result<T, E>` is the correct way to define error-prone functions.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.