15
u/The379thHero Jan 11 '20
How hard is it to do if else rather than two separate if statements. There are probably 3rd graders who can avoid this mistake
6
Jan 11 '20
I need more GTAV Trevor memes
2
u/ThatDudeFromPoland Jan 11 '20
GTA V's Dialogue is an unexplored gold mine
2
4
3
u/Mearrx Jan 11 '20
Ugh this is like the tenth time I’ve seen this same thing when is this gonna end
3
u/P4INKill Jan 11 '20
<p>Your Score {Math.round(score * 100)}%<br/>
You {score <= reqScore ? 'FAILED' : ''}{score >= reqScore ? 'PASSED' : ''} the Exam.<br/>
Required Score {Math.round(reqScore * 100)%</p>1
u/Donghoon Jan 16 '20
Too much? Isn’t using if else shorter
1
u/P4INKill Jan 16 '20 edited Jan 16 '20
If else doesn't give you FAILEDPASSED. I was on purpose writing the shitty code on display in the image.
Notice how both checks are true if score == reqScore.
1
2
1
1
u/kimchi01 Jan 11 '20
Not exactly the same, but I had to take microeconomics in college. I failed the first time so I set it to pass/fail and would have gotten an A otherwise. The professor used the exact same test I did the first time.
1
1
1
1
1
u/RedValorX5G Jan 13 '20
Honestly this happened to me for my drivers test a few months ago. The instructor told me I failed, but then I revived a certificate that I passed. I still don’t know if it was a glitch, but it’s whatever, I’m not going through that again.
-26
u/dogydino200 Jan 11 '20
It's not an inclusiveor
24
u/Sackofwack Jan 11 '20
“Did I fail or pass” “Yes”
Not everything has to be explicit for it to qualify.
-15
u/dogydino200 Jan 11 '20
There is no or question, nor is there any sort of "Yes". It's failing literally every qualification of this subreddit and there are only two. Also it's a repost of the second most upvoted post on this subreddit, but that's a serpate issue
8
3
u/Sackofwack Jan 11 '20
Also if it’s one of the most upvoted posts on the subreddit then shouldn’t that be an indicator that it’s an inclusiveor?
2
u/dogydino200 Jan 11 '20
No, because it's still not an inclusiveor and it's a repost. Stop making new replies, just edit your comments
0
u/ky_zz Jan 11 '20
Jeez man we just wanna enjoy this post stfu with your “tHiS iSnT aN iNclUsiVeOr” stfu jeez
2
1
u/Crimson097 Jan 11 '20 edited Jan 11 '20
An inclusive or is when two things can be true at the same time. In this case, he passed and failed at the same time. The format with the question and the yes is the lazy way to do it. This post does it a lot more creatively. The only issue here is that it's a repost.
0
u/dogydino200 Jan 11 '20
There's a subreddit for these posts, they made it since there were so many posts that didn't follow the format. The rules are quite clear what is an inclusiveor, it's an or question that's answered with "yes" or something similar, with slight variation.
0
u/Sackofwack Jan 11 '20
The question is the person taking the exam wondering in their head “hmm did I pass or fail. Let me find out.” And the programs response is the equivalent of the “yes” Not rocket science bud.
-3
u/dogydino200 Jan 11 '20
Again, it doesn't matter if it's implied since the post itself doesn't actually mention anything remotely close to a question. This is the most basic rule of the subreddit.
5
u/Sackofwack Jan 11 '20
I’m unsubscribing from this sub now that I realize who it’s subscribers are. Peace
0
3
u/Sackofwack Jan 11 '20
I just want to look at posts and enjoy them not nitpick the smallest things
2
u/dogydino200 Jan 11 '20
You replied to me
3
u/Sackofwack Jan 11 '20
You posted the comment
2
u/dogydino200 Jan 11 '20
Because it's not an inclusiveor... It's like posting an image of your cat on r/memes
0
u/Sackofwack Jan 11 '20
Based on your point means that anything not explicitly stated cannot exist. You probably don’t get body language or metaphors or sarcasm or jokes or anything that involves you thinking and reading between the lines.
→ More replies (0)2
u/Sackofwack Jan 11 '20
Also just looked at the rules and there was nothing state about it having to be explicitly stated, rather just present.
2
u/dogydino200 Jan 11 '20
Literally the first rule dude. The post must be an inclusiveor, this isn't an inclusiveor. It doesn't need to be said that the post must contain a question because that's literally the entire point to this subreddit
3
u/Sackofwack Jan 11 '20
There is a question!! It is very obviously deduced if you have even one brain cell
0
Jan 11 '20
[deleted]
128
Jan 11 '20
Math is hard. The last time I tutored programming I went through some code with this girl who clearly didn't understand what an infinite loop was and how there is no circumstance where a number won't be either more than 1 or less than 5.
6
u/loyk1053 Jan 11 '20
Doesn't 2 3 4 fit the criteria?
23
u/put_thelotion Jan 11 '20
2 3 4 are both more than one and less than five; the point is that there isn’t a single number that is neither more than one nor less than five
those sets overlap at 2 3 and 4 and continue towards infinity in opposite directions
12
u/TheTVDB Jan 11 '20
i is neither greater than 1 nor less than 5. I know it doesn't work in context, though.
2
3
1
u/HeadpatsUnlimited Jan 15 '20
I have to put this another way because it's killing me. You're saying that there is no number that simultaneously coincides with the properties of not being more than one and not being less than 5. As in, every possible number is either more than 1 or less than 5? A number can't be neither of the two?
Fucking double negatives.
1
u/put_thelotion Jan 15 '20
there is not a single real number in existence that wouldn’t be either more than one or less than five. the two sets are
numbers more than one
numbers less than five
every real number fits into one or both of these sets, since the sets overlap between 1 and 5 (2,3, and 4 are simultaneously more than 1 and less than 5)
the girl in the original problem didn’t realize that there is not a real number that isn’t a part of one of those sets
does this help?
1
u/HeadpatsUnlimited Jan 15 '20
So you're saying my last comment was correct then?
1
9
u/PuttingInTheEffort Jan 11 '20 edited Jan 11 '20
'or' is programming logic.
If number is greater than 1 or less than 5, print "end"
Any number will be either of those. If the function was to do something and try again, like subtract 1 and retry, it'll just loop into subtracting one forever. Idk why you would need a function like that though.
If you said greater than 1 and less than 5, only 2 3 and 4 would work.
1
Jan 13 '20
i'm a first year CS major so i may be wrong but I was taught that the truth table for "or" is
input output
00 0
01 1
10 1
11 1
And it would have to be xor to be the case described.
but i also haven't dealt with this much yet so like I said I may not be right
1
u/PuttingInTheEffort Jan 14 '20
Afaik from highschool programming class
Or: one or the other
Xor: one but not the other
1
u/itirix Jan 27 '20
You're correct. Every real number that exists would evaluate to 01, 10 or 11, resulting boolean always being 1.
1
u/SenchaLeaf Jan 11 '20
That's... not math... is it?
Also, I did something to the effect of
while (true)
Then too... I mean, as long as we study, eventually we should get better?
1
0
Jan 11 '20
[deleted]
26
u/4SakenNations Jan 11 '20
The neither and nor didn’t help
1
u/HeadpatsUnlimited Jan 15 '20
With it having those negatives like that, trying to sort it out kind of hurts. Like I'm trying to look in two opposite directions at the same time.
3
1
u/ThatWannabeCatgirl Jan 11 '20
Not only that, “You ____ the exam” had to have been hard coded with the “if” statement where the blank is instead of the whole message just being in the if
1
1
23
81
u/Thighbone_Sid Jan 11 '20
if (score <= 85) {
}
if (score >= 85) {
}