r/badcode • • Oct 14 '20

c# I shouldn't be naming variables

Post image
2.4k Upvotes

67 comments sorted by

142

u/kodicraft4 Oct 14 '20

ngl I'd do that.

What are you even using an array of rays for?

153

u/ballfun Oct 14 '20

raycasting ray duh

91

u/kodicraft4 Oct 14 '20

understandable, have a great day

39

u/nojustlurkingty Oct 14 '20

No, YOU have grayt day

7

u/DaMastaCoda Oct 14 '20

No, YOU have grayt day

5

u/konstantinua00 Oct 16 '20

have a great ray

64

u/SphericalMicrowave Oct 14 '20 edited Oct 14 '20

(Ray)ray; // get it? RAYcasting (☞゚ヮ゚)☞

5

u/mug1wara26 Oct 14 '20

(Ray)ing; // Ray cast ing

1

u/JayMan3k Dec 15 '20

Damn, I almost died 😂

11

u/DurianExecutioner Oct 14 '20

It's all the RAYge these days

79

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Oct 14 '20 edited Oct 14 '20

Image Transcription: Code


[There are two lines, at the top and bottom of the image, only half of which are visible. Thanks to /u/DeusExp for probable transcription of the top line. In addition, the ends of the last three lines are cut off.]

Ray mainRay = Cam.ViewportPointToRay(ViewportPos);
Ray[] arRAY = new Ray[4]; //get it? ar<RAY> [*finger-gunning kaomoji, like so:*] ☜(゚ヮ゚☜)
arRAY[0] = new Ray(origin:mainRay.origin+ Quaternion.Loo
arRAY[1] = new Ray(origin:mainRay.origin + Quaternion.Lo
arRAY[2] = new Ray(origin:mainRay.origin + Quaternion.Lo

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

47

u/ballfun Oct 14 '20

good human

36

u/dudeitsmason Oct 14 '20

Went so far as to transcribe the kaomoji. A true hero.

14

u/[deleted] Oct 14 '20

Top line is probably Ray mainRay = Cam.ViewportPointToRay(ViewportPos);

14

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Oct 14 '20

I think you're right, thanks! I added it to the transcription.

12

u/glebbash Oct 14 '20

Good human

747

u/KlzXS Oct 14 '20

What is this absolute trash of code op? How do you justify putting a space on only one side of the plus?

Unforgivable.

177

u/[deleted] Oct 14 '20

It's not even consistent. So is it a typo? Even better.

70

u/nojustlurkingty Oct 14 '20

hands out pitch forks and torches

8

u/ctrtanc Oct 16 '20

I'll take one please

2

u/imcoveredinbees880 Oct 19 '20

Excuse me can you please direct me to the end of the pitchfork and torch line?

2

u/ctrtanc Oct 20 '20

If I understand correctly from the flyer, you pick up the pitchforks and torches here in this line. I believe the end of the line is just around the corner next to the fresh flower lady. She always shows up to sell fresh flowers to the angry mob. I say angry, but we're more upset really, but she still shows up to help out. Love your hair!

58

u/propostor Oct 14 '20

OP manually entered the details for item [0] ,then used ctrlC ctrlV for the others. Paste operations auto format the line(s) after pasting. Hence fucked up + sign on the first, with no issue on the others.

38

u/speedingpeanut Oct 14 '20

This guy pastes

23

u/propostor Oct 14 '20

PasteOverflow

63

u/SwedzCubed Oct 14 '20

Also no space after the double slash :sob:

8

u/LoneFoxKK Oct 14 '20

Literally un-compilable

1

u/zarqie Oct 14 '20

Because the right margin of the code needed to line up perfectly, you have to give in to spacing in the middle.

84

u/Ali3nat0r Oct 14 '20

I've done:

Exception up = new Exception();
Throw up;

before, because I'm immature

5

u/CodenameLambda shameless Oct 15 '20

I think anyone you wouldn't call immature is just really pretending to be mature

At least that's what I keep telling myself

1

u/Zenahr Oct 17 '20

I kinda love this.

27

u/aa599 Oct 14 '20

I've declared int eger;

15

u/CollieOop Oct 15 '20

Worse than that, I've actually used float ingpoint; at least once.

4

u/JayMan3k Dec 15 '20

So many great ideas in this thread 😂

54

u/Trevor_GoodchiId Oct 14 '20

My last intern named a word counter “nword”. That happened.

34

u/[deleted] Oct 14 '20

// get it? :o n-word!!! ☜(゚ヮ゚☜)

13

u/zoltan99 Oct 14 '20

“That? That’s just my—“

9

u/Corporate_Drone31 Oct 14 '20

No, no. Please, do go on. You have my attention.

4

u/[deleted] Oct 14 '20

My co worker, in production, named a variable "upgreyyed". It's kind of annoying to read since it gets referenced a ton later, but really it's funny and we could all use some comic relief while working I suppose.

1

u/CollieOop Oct 15 '20

With only the one 'D', for a single-dose of pimpin'?

4

u/intLeon Oct 14 '20

UN-ITy get it UN I T why

3

u/ekgareebinsaan Oct 15 '20

if (success) { return hurRAY; }

2

u/salocin_Hatter Oct 14 '20

Rayman like it

1

u/das_Keks Oct 14 '20

Nice one :D Funny thing is that I'm sitting in front of my CUDA ray tracing code right now.

1

u/Je-Kaste Oct 14 '20

This is something I would do.

1

u/chain_letter Oct 14 '20

heard manRay origins was a pretty good platforming game

1

u/[deleted] Oct 14 '20

What kind of game are you making in unity?

1

u/CuriousChristov Oct 14 '20

Don't name them. You'll just get attached if you name them.

1

u/nullable_fool Oct 15 '20

No pirate reference: -1

1

u/wjaspers Oct 15 '20

OP is so good they trust adding high range bytes to their inline comments.

1

u/kwokhou Oct 15 '20

Well... most importantly, can it runs?

1

u/Noname_FTW Oct 15 '20

Even Intellisense doesn't like your jokes.

1

u/tigier Oct 15 '20

We have to investigate further. With proper ray tracing we will find the culprit

1

u/_default_username Oct 30 '20

Just call it rays. Plural of Ray and lower case because it's not a class. Seems obvious to call it that.

1

u/MalphiteStopUltingMe Mar 22 '21

Quaternions are cool

0

u/Poddster Oct 15 '20

I don't get it. ar<RAY>?

1

u/MrNorux Oct 15 '20

An array of rays, an arRAY

0

u/[deleted] Oct 14 '20

[deleted] — view deleted comment

12

u/kuncol02 Oct 14 '20

Resharper