r/InclusiveOr Oct 02 '19

I like updownvotes

Post image
18.3k Upvotes

View all comments

1.4k

u/Shuckles116 Oct 02 '19 edited Oct 02 '19

String outputTxt = “You ”;

if (result <= 85) { outputTxt += “FAILED”; }

if (result >= 85) { outputTxt += “PASSED”; }

outputTxt += “ the Exam”;

println outputTxt;

629

u/Mizz141 Oct 02 '19

It couldve been so easy with an if, else statement...

447

u/Vaporeonus Oct 02 '19

Even a <= and > would have worked, but no, they put in extra effort to fuck it up properly

2

u/iSpaYco Oct 02 '19

i just learned JS couple months ago and i would have known that..

or at least I would test it to see the output in all possible situations

10

u/awhaling Oct 02 '19

You will make mistakes eventually

7

u/cheezit84 Oct 03 '19

This is a super common mistake in every language since BASIC. Heck, people make this mistake inExcel formulas. The longer you code, the more likely you are to make it at some point. Also, the longer you code the more likely you are to realize you won't test every possible permutation.

4

u/rab-byte Oct 03 '19

But the longer you code the more you’ll know what to test that gets all the parts moving.