Skip to content

re: There's no "else if" in JS VIEW POST

re: That was my point, Idan; if-statements are just conditional jumps, and you need those to be Turing complete. I disagree with the idea that if-state...

I understand whose is in the functional is alergic to IF statement, but a coder can create a good program without a functional approach. Many developers write code in procedural mode, if you use GNU/Linux you'll know that in many files you'll find IF statements

One might use Linux for decades and never ever see a single line of the code.

Thatโ€™s true, there are very specific circumstances under which if might be the best choice, but all those are exceptional nowadays. 99% of businesses use high-level languages and in high-level language, no matter whether itโ€™s functional or not, ifs are a sin.

99% of businesses ????????
If you consider that COBOL has been back ...
If you consider that many banks prefer continue with old COBOL (not the new one) for the ATM services.
I you consider that big manifactures build products IoT with a poorly code and very buggy.
I think that you're developing for excelence, despite I've seen in your code of elixir-iteraptor some IF statement

Legacy is legacy, there is no doubt (although COBOL was invented as a most imperative language ever.) I admit I exaggerated the percentage, though.

I've seen in your code of elixir-iteraptor some IF statement

I never said I am perfect. If I had 72hrs/day I would be always writing the good code avoiding ifs. This is a solid settlement: I use ifs to save some time, while I still expressly understand I could do better.

I'm intrigued by what you said about if-statements. I'm curious to know how you would write the following callback function.

someRequest(URL, (err, result) => {
    if (err) {
    } else console.log(result);

I'm still a novice so it's difficult for me to imagine doing some things without if-statements. I would appreciate it if you could show me๐Ÿ˜…๐Ÿ™‚.

You could use something like promises.

.then(result => console.log(result))
.catch(err => console.log(err));

Ooh. That's right. Forgot promises could do that๐Ÿ˜…. Thanks ๐Ÿ˜Š

code of conduct - report abuse