No it isn't. This is the sort of thing programmers with a few years' experience think is clever, but it's not: it's just another way of swimming while hog-tied and then saying, "Look what I can do". I mean - come on: do you really think throwing exceptions and returning error states is more readable than using "else"?
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
It depends, but oftentimes yes, because an "else" is a sign that your function is doing more than one thing, and a lot of people's programming philosophy revolves around making functions only do one thing.
I know - again: good for really simplistic stuff, but in the real world, if you make every function do only one thing, you have to have so many of them that your code becomes spaghetti. Besides, avoiding an else in one function simply means you have to move it to another, or use a case instead, which is a bunch of glorified else statements: if the program needs to decide a thing, it's going to need to decide it somewhere.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
No it isn't. This is the sort of thing programmers with a few years' experience think is clever, but it's not: it's just another way of swimming while hog-tied and then saying, "Look what I can do". I mean - come on: do you really think throwing exceptions and returning error states is more readable than using "else"?
It depends, but oftentimes yes, because an "else" is a sign that your function is doing more than one thing, and a lot of people's programming philosophy revolves around making functions only do one thing.
I know - again: good for really simplistic stuff, but in the real world, if you make every function do only one thing, you have to have so many of them that your code becomes spaghetti. Besides, avoiding an else in one function simply means you have to move it to another, or use a case instead, which is a bunch of glorified else statements: if the program needs to decide a thing, it's going to need to decide it somewhere.