Exercise on Errors

Here is an exercise you can solve to test your understanding!

We'll cover the following

Assignment

Copy your Sqrt function from the earlier lessons and modify it to return an error value. (This online assignment may be useful)

Sqrt should return a non-nil error value when given a negative number, as it doesn’t support complex numbers.

Create a new type

Get hands-on with 1400+ tech skills courses.