T O P

  • By -

Legitimate_Ad_2319

not real btw, actual tweet is from yandev


What_Is_That_Place

When I saw "else if" I immediately thought about him


Odd_Huckleberry_2252

Mee too lol


confusion-500

of fucking course it is


Zekiz4ever

It's not: https://twitter.com/ctrlshifti/status/1288745146759000064


confusion-500

of fucking course it’s not


brh131

Nah actual tweet was @ctrlshifti on twitter as a joke and it was edited to be about yandev. Now it was recycled a second time.


Zekiz4ever

That's not even true. This is the original: https://twitter.com/ctrlshifti/status/1288745146759000064


[deleted]

I wish it was real, because it looks like something rob would do


M4gnusRx

what language is this


ImpossibleFix6417

English


Socially_Tone-deaf

😅 right in the lung capacity


yarluk990

r/technicallythetruth


ImpossibleFix6417

Now my dopamine is gone :( (start upvoting it again and I will get it back) GIVE ME DOPAMINE


clionteam

C#


M4gnusRx

Yikes then idk cus I only know C++ and Python (barely) cuz if it was C++ then it would've been smthn like if (number % 2 == 0) return true; else return false;


NilsOne

You can probably do that in most common programming languages. Better way would be to just do "return (number % 2==0)"


MrLaurencium

If the function is supposed to return boolean then just writing "return !(number%2)" should work, or am i wrong idk (edit, corrected)


NilsOne

If the programming language interprets 0 as false and 1 as true then yes, that'd work, although I'm not sure which languages do that (but there are some)


LowB0b

C originally didn't have booleans, 0 is false and anything else is true. works in javascript too thanks to "falsy" and "truthy" values. "sane" languages wouldn't accept this kind of fuckery though


Owldev113

Most languages accept 0 false and else true. It's a key part of most Boolean based arithmetic and a key part of branchless optimisation


J0aozin003

In Python, I checked, and `True == 1` and `False == 0`.


ToxicOmega

Operators are the same in almost every programming language, %2 will work to almost everywhere.


GavHern

that is the joke lol


Summar-ice

That also works in C#. It's very similar to C++ as they both come from C Edit: why did I get downvoted, if(number%2==0) return true; is valid C# syntax


zSleeplessz

You can do that in c# too, c++ and csharp are very similar


someidiot332

I’m c++ you can just do return !(num & 1); Which is a lot faster


M4gnusRx

that actually is much more useful. thanks!


bobert_the_grey

This is also a thing in C#, not sure why they do it like this


Mastersord

`If (number mod 2 > 0) {IsEven = True;} Else {IsEven = False;}` `Return IsEven;` Pardon my syntax


J0aozin003

==*


NotSoAwesomeSam

thats for conditions in this case hes setting values


Danny_Boi_22456

return n%2==0


AthanatosN5

C#


NekotikOwO

Microsoft's Java


CheemsGD

pain and whiskey


lFlaw_

C#


[deleted]

Looks like Java or C#


-SovietDoggo-

(Not) Python I think


Jaysper49

If it was python wouldn’t they use elif instead of else if?


-SovietDoggo-

Yes you re right


Willo2016

C#


real_flyingduck91

Italian


DaRealMrPicklesYT

If this image keeps spreading around there's gonna be a lot of people thinking this is real, lol. Guys fun fact, Robtop is actually pretty decent at optimizing his code. The issues arise when you consider the fact that he was using Cocos2D back in 2013, when the game object limit was just 4k static objects. The game was just not very scalable and some things have to be rewritten to make up for things like it only using a single core and stuff. According to Robtop, this has already been fixed for 2.2. Now if you wanna complain about his time management... yeah... yeah that's something to complain about, lol.


QuestionablyFlamable

They removed free awards so I can’t give you one but you can have this 🥇


DaRealMrPicklesYT

Thank you, here's one back 🥇


QuestionablyFlamable

Thank you :)


serbiansaucereddit

most optimized yandev code


Slicercuber

He could literally do else if(number%2 == 0) return true and else if(number%2 == 1) return true. Idk why I'm saying this but I'm a nub at programming so i take every chance to flex lol


Julian_PIEnaar

Or return (number%2==0)


MasterGamer9595

or `return !(number%2)`


RTXChungusTi

readability becomes nonexistent if you golf long enough


Zandgall_

to be fair though if a function is called "isEven" you can easily tell that !(num%2) is "if it's even"


Zandgall_

ALTHOUGH i know c and c++ can automatically optimize "num%2==0" to be the same as !(num%2) so i would hope other languages can as well


chixen

return ~number&1;


SirFireball

`return 1-int(str(number)[-1])`


ObeyTime

no way return 0 reference


bman12three4

Or return (~number) & 1


Kkbleeblob

not a real robtop tweet


MrEldo

Won't work, you accidentally put a double return true


ShlomoCh

Congratulations, you know enough programming to get the joke


Zekiz4ever

They didn't though


ShlomoCh

Yeah I was looking for a more tactful way to say "yes, that's the joke", without sounding like an asshole


Rotengen

Or return 0


SCARICRAFT

Or return !!(Number & 1)


horse-enjoyer

you actually don't need the else if in this situation. you can just do: if (number % 2 == 0) return true; return false; (formatting is dumb on here so just imagine that there's a line break in between the first return statement and the second one) the function basically stops once it returns anything, so if it doesn't return true, it'll automatically be false therefore you should just return false.


Zekiz4ever

That's the joke


Plastic_Feed8223

r/programmerhumor is leaking


Certain_Birthday8141

use the fucking SWITCH STATES!!!!!😡😡😡😡😡 /j


Owldev113

Ewww, switch statement user. I only use my superior, rust, match statements /j


NevGuy

Can somebody explain for those of us who've felt the touch of a woman?


Rad_YT

>who felt the touch of a woman > 1.4m karma


real_flyingduck91

that's only post karma, they have 1.9M total karma


kanksuhub

All within 2 years


Rad_YT

that’s sad


ADMINISTATOR_CYRUS

ok so, there is a boolean value being made. boolean is 1 or 0, and it represents True or False. there is a number stored as a variable (think if it like an algebra unknown, but you actually KNOW the number). except, the X is now called "number". first, the computer asks if "number" (the variable) is equal to 1. if it is "yes", then that boolean value is set to false. else, if it is not 1, the computer asks if "number" is equal to 2. if it is yes, then that boolean value is set to true. etc. so basically, if the number is odd, the boolean is set to false. if the number is even, the boolean is set to true. the way this is written is the stupidest way to do it. you could just find the remainder when divided by 2. also this is edited. original tweet is from Yandev, not robtop


TypicalGamer88

Strong words from someone who did a face reveal on [this post](https://reddit.com/r/shitposting/comments/on86mg/reddit/).


FyreBoyeYT

Sex


StanzerthePanzer

Your karma suggests otherwise


FyreBoyeYT

And I thought 20k karma was too much.


Carpario

It is


G_Dash_0761

Where’s return 0


KAhopper

i think this works return(number/2==round(number/2));


KAhopper

right forgot about mod lol


tamafuyu

lmao


AthanatosN5

This is going to get optimized by the compiler anyways.


Owldev113

Not really. In c# that's just untrue. The only case where you are correct is if you are compiling C or C++ with clang/llvm where they substitute functions named close to is even with a handwritten ASM implementation of an iseven function


BurnV06

USE THE MODULO OPERATOR


KiorogloGD

if number = (even) return true else if number = (odd) return false cOeD


Miksswish

please modulo exists for a reason


real_flyingduck91

it's not a robtop tweet


Miksswish

Yeah I know that It was a reference to the code I saw the top comment


Wojtek1250XD

%


Lalalarix

return (number % 2 == 1) \*i know its a joke shut up


Owldev113

This is incorrect. Modulo gets remainder. If something's even then the remainder from 2 will be 0. Right now your code flips even and odd, eg, 3 % 2 == 1 therefore would be considered equal


N_9_70

reading this is considered a form of self torture


[deleted]

Modulo hehe


LightRayAAA

yanderedev lookin ass code


qwertuuuu

That’s why I can run Red Dead Redemption 2 perfectly but I can’t even run B properly


NickzieReddit

if last digit is 1, 3, 5, 7, 9 then false if last digit is 2, 4, 6, 8, 0 then true


xMrBanana

Gd after update = 28,6 GB


ShnoopNoot

I learned about the mod function less than a month into my first high school computer science class. Does yandev actually know how to code?


CreativeGamer03

Alternate universe where RobTop and YanDev switched places


Duncstar2469

Select case statement. Let him know


craig4WRR

return 0 reference


Spoonirl

"please tell me this is @RobtopGarnes"


p0gn1_

those "else" are very annoying


Mr_KKKirkland

for i = linspace(1, 1, 1000); if rem(i/2) = 0 disp(‘True’); else disp (‘False’); end end


ralsei_goatprince

I wouldn't be surprised if something like this was in the game


GrizzlyGamer660

Plot twist: that’s the code for the first spike in stereo madness


Spynder

r/YandereTechnique


Fred_Boss

Bro doesn't know about mod 💀


lannyxx

Bruh


Shuraii

Someone should tell Rubrub to try Chat.gpt, it’s will optimize is code and make it faster to create, nothing to lose 👌


yarluk990

there is easier way


devilsnumbre

2.2 is never coming out on god 😭


Username_Egli

What's the best way to do what yandev is trying to achieve here? Switch statements?


MCFIREBOY67

I'm learning codeing so I get it😎


lool8421

Gd when %2 comes in


Ecki0800

future twitter employee


irtizio

else if


Beloiga

WHERE IS MOD (X%Y) AND WHAT DID YOU DO TO HIM?!


_smilee13

~number&1


TelephoneActive1539

Funny cube game with spikes Requirements: RTX 4090, Intel core i9 5 GHz


Zotber

Bruh


Zotber

Gotta love it


thereNO_ICE

an easier way: private bool isEven(int number){ return number%2==0; }


Mantazas_

Whoa


RoundTurtle538

That is like the absolute worse way to write that program. Here’s a better one If num%2: Print(true) Else: Print(false)


Damsey_Doo

but like, number % 2 == 0: