[][src]Function show_notes::e003::get_a_result

pub fn get_a_result(succeeds: bool) -> Result<f64, String>

Shows how to return either a meaningful result or an error as an enum.

The Result type is a standard pattern for handling cases where the result of a given function may be an error. No more of the C/C++ pattern of passing in/out arguments so that you can get a normal/error-indicating return code. Instead, you just return a Result, and then match on that value to handle it.