28.3
#1280
Replies: 2 comments 1 reply
-
I think the idea here was that the instructor would demonstrate refactoring the code to use |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sure. In all the cases before here, I think there's been a note to the instructor to this effect when they're supposed to do something. (I'm just doing the course myself, so there is no instructor!) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I guess I was expecting the code shown here to use
?
to simplify the error handling? Or was the idea that instructor or student did that.Certainly, the first match seems suitable for using
?
:The second one, because of the compatible types point, is slightly less straightforward. I changed it to:
which seems to compile and run OK. (I presume it's OK because any error would have been propagated before the return value if it had occurred).
Not sure whether you intended to do the simplification, but it reads as if you did, either by showing both or just the simplified version.
Beta Was this translation helpful? Give feedback.
All reactions