For me looks good. I have tested it on my MX Linux distribution.
It’s interesting how much the code says about it’s author. In my case 7 years in Elixir gives result …
-
Even if somehow I remember somewhat about
try/catchI was still looking for a “better” solution, so I have added one extra dependency for a singleisdigitcall.
-
std:errof course! When I saw your code I have reminded it immediately.
-
stdexceptis interesting. Maybe I have used it, but I don’t remember it much especiallye.what()call. I guess that I haven’t used multiple catch blocks before inC++.
-
out_of_rangeerror handling is simple, but also brilliant idea. I’m not surprised that I wasn’t thinking about such edge case since inElixirwe have justIntegerfor all well … integers (no small or big ones).
-
I only wonder why you define
numvariable outside oftryblock having in mind it’s only usage is within it, but that’s definitely not the most important thing.
So much to learn in such a small code, thanks! ![]()
Adding additional links below to the documentation pages: