Time for a Break
Sometimes when we’re programming, we like to exit our loops and functions early. There are a number of reasons to do it, but a common one is error handling. When we covered functions and loops before, we skipped over this ability; we’re going to finally introduce it here. We’re also going to introduce how error handling works in Rust, which will set you up for interacting with lots of library functions in the future.
Let’s say I’ve got a simple program that prints out the first 10 primes. It might look something like this:
Get hands-on with 1400+ tech skills courses.