Hi im in the handling error section on the enum part, i have errors in the code while Zsolt the instructor was able to run the code, i even copied the code but still the same.
I cant find what is the problem we use the same version and the code is the same.
`
enum Result<ValueType, Error> {
Ok(ValueType),
Err(Error)
}
fn divide(a: f32, b: f32) -> Result<f32, String> {
if b == 0.0 {
return Err(“Division by zero”.to_string()); // have error here mismatched types
}
return Ok(a / b);
}
fn print_result(result: Result<f32, String>) -> () {
match result {
Ok(value) => { // error here mismatched types
println!(“Result: {}”, value);
}
Err(message) => {. // error here mismatched types
println!(“Error: {}”, message);
}
}
}
fn main() {
let num = 5.0;
let b1 = 2.0;
let b2 = 0.0;
print_result( divide(num, b1) );
print_result( divide(num, b2) );
}`