Tutoring Section 5: Exceptions and Iterators

Exception and Iterators

Exceptions are basically error handling. We want to make sure that our methods and functions do not return some values that wouldn’t make sense for that particular function. Implementing try-catch-finally blocks or throwing exceptions are really useful since they allow us, coders, to customize and implement these situations that we need to be handling errors.

Iterators and iterables are really useful because, in this paradigm of functional programming, we want to abstract away as many details as possible since this brings in a lot of universality and efficiency when working, for example, cross platform. Being able to understand and work with iterators will not only be more efficient but will also clean up your code a lot more.

Resources

Walkthrough videos

  • Video (Q2)
  • Quiz Q1

Note: The tutoring worksheets are property of CS61B(L) and are solely intended for the purpose of personal use.