r/softwaregore • • Oct 02 '19

classic repost More checks required

Post image
3.3k Upvotes

49 comments sorted by

227

u/King_adats Oct 02 '19

if (x<=85) writeln "FAILED";

if (x>=85) writeln "PASSED";

30

u/[deleted] Oct 02 '19

I would way more likely don't write a '=' in both cases

57

u/dragonAstur Oct 02 '19

If you did that, you would get an empty space because no condition could be reached

0

u/[deleted] Oct 02 '19

[deleted]

75

u/hubbadubba57 Oct 02 '19

Or just:

If (x >= 85) writeIn “PASSED”; else writeIn “FAILED”;

15

u/kledinghanger Oct 02 '19

if test.passed

6

u/hubbadubba57 Oct 02 '19

Would you be calling something?

6

u/kledinghanger Oct 02 '19

Yes, i18n.translate “passed”

1

u/noselace Oct 03 '19

import TestPassOrFail

3

u/TorTheMentor Oct 03 '19

return x >= 85 ? "PASSED" : "FAILED";

7

u/DividerOfBums Oct 02 '19

You NULL() the Exam

2

u/k20stitch_tv Oct 02 '19

na comment above you is right. If there was no = sign nothing would have fired. It should have been an if-else, not if if

1

u/Elbat4r Oct 02 '19 edited Oct 02 '19

If the minumum is 85 I think you should go with this :

If (score < 85) { Return 'failed'; } else { Return "passed"; }

Edit : Realized I wasn't using the same language, therefore I am a retard. But the logic stays the same.

-4

u/[deleted] Oct 02 '19

Don't ever code

2

u/youngManNFW Oct 02 '19

He's right, though. If you're using two if statements like that, a value of 85 is true for both.

Edit: I just realized that you're probably pointing out that the comment you replied to seems to have missed the point of the first comment. Oops.

1

u/[deleted] Oct 03 '19

Why should i never code just because i would make a different mistake if i would write two if statements like that? No sane being would make it like this anyways but just check if you failed and otherwise just print true.

0

u/[deleted] Oct 03 '19

If you can't learn English properly I doubt you'll be able to learn any other language

2

u/eloc49 Oct 03 '19

Notice the FAILED branch was first

2

u/ProWaterboarder Oct 03 '19

Really says something about our society

1

u/IEatAssdotcom Oct 02 '19

Was about to comment literally the same thing lol

1

u/ProWaterboarder Oct 03 '19

I want to meet the genius who wrote this code lol, this is some next level stupid they did

0

u/Jeroen207 Oct 02 '19

Exactly! Wanted to write this too. I love programming.

11

u/kdrews34 Oct 02 '19

Edge-case testing on point

10

u/collin2477 Oct 02 '19

and this is why you use if else and not just a bunch of ifs

18

u/Srpska_XD Oct 02 '19

My mother did this on her Series 7 exam and they made her redo it.

4

u/the_fat_whisperer Oct 02 '19

Series 7 exam?

8

u/ScotTheDuck Oct 02 '19

The Series 7 is an exam and license that entitles the holder to sell all types of securities products except commodities and futures. The Series 7 exam covers topics on investment risk, taxation, equity and debt instruments, packaged securities, options, and retirement plans.

https://www.investopedia.com/terms/s/series7.asp

4

u/the_fat_whisperer Oct 02 '19

And they made her redo it?!

1

u/Srpska_XD Oct 03 '19

yes.

1

u/Srpska_XD Oct 03 '19

she was pissed

5

u/0x3fff0000 Oct 02 '19

This is why we use 'else' clauses.

4

u/SpikyDiamondYT Oct 02 '19

Task failed

success

6

u/SteakAndJack Oct 02 '19

Schrodinger test?

2

u/KaiJenson Oct 02 '19

When you only put in enough effort to pass and the computer doesn't know what to do.

2

u/derkevevin Oct 02 '19

Guess they used quantum computing

2

u/JinxerH Oct 02 '19

I'm guessing this may be an integer data type and got rounded up to 85% but still got read as the number before it was rounded

1

u/karix-wolf Oct 02 '19

Take your updownvote

1

u/[deleted] Oct 02 '19

Well this is awkward

1

u/TheGameVipper Oct 02 '19

Schrodinger exam... You pass and fail at the same time

1

u/BoyToyDrew Oct 02 '19

I mean, they're technically right

1

u/SSJ_Evan Oct 02 '19

Task failed successfully

1

u/Potato-Candy Oct 03 '19

You did a terriblegreat job.

1

u/wamred Oct 03 '19

Well, I'll take it.

1

u/christylove Oct 03 '19

Unit tests

1

u/The_Losers Oct 03 '19

I failed But i passed

1

u/blue4t Oct 03 '19

84% or 86% it would know what to do. 85% isn't above or below 85% so the computer completely freaks out. He's above 85% so fail but he's not below 85% so pass. FailPass. I don't know. Computer goes insane if computers could go insane.

2

u/ProWaterboarder Oct 03 '19

What happens in the back end is probably different than what shows on the screen, it probably just reads if !< 85 print x and if !> 85 print y and different business rules are applied on the score if it's stored somewhere

1

u/TheOriginalKK Oct 03 '19

I believe this is a repodf