The Error Handling section of The Book is confusing
This is my first time learning a general-purpose language, and I'm finishing chapter 9 of the book. So far, this is the most confusing chapter I've read.
As far as I understand it, there are two types of errors in rust: panic! and Result.
Using panic!, ends the program with an exit code and unwinds the code (idk why, to release memory, maybe?). You can disable unwinding in cargo.toml. You can use panic! anywhere.
Using Result or, unwrap, or expect, or "?" returns either the item or an error, which then has to be handled.
The 9.2 chapter does not handle errors, in my opinion, the right way (for learning), because, in the examples, the code uses panic! when an error arises and because of that I have no idea how to handle an error without panic!
Could someone please put me on the right path how to actually handle Result errors (without panic!) with a simple code example?