Itt: non-jerkoff versions of pic

my attempt

do
{
this.life();
} while(1)


>inb4 stack overflow

>filename is cringe.jpg
kek
e
k

Pic AND OP post are cringe

omg, user you are like a leet coder now. you've mastered predicates, holy shit. that usually takes people years, if they're retarded, and 1 second if they're not.

sad() returns a bool, but a bool that has a member function called stop().

I can understand why they'd be so sad if they write code like this.

we all tried to tell them javascript was a horrible idea. they just wouldn't listen.

now look at what they're doing.

>===
rrrrrrreeeeeeeeeeeeeeeee

> ====
We need more equality

Is it even possible to have it so that sad() === true and sad().stop() is callable? Maybe if they did something with Proxy, but I doubt they're competent enough to use it properly.

It's very possible. Just keep a switch that toggles when it's run the first time.

if (you.isSad())
you.kys();

>OOP
I vomited three times reading this

> if (sad() === true)
>not if (sad())

Disgusting

Couldn't that be optimized to
while(1) this.life()
?

It's ECMAScript, which is weakly typed, and doesn't the === operator do type conversion? Apparently sad() returns an OBJECT (given that you can call the stop() method on it), which can be interpreted as true or false. So really what it's doing is:
>call the sad() function
>if the object it returns can be interpreted as TRUE, then
>>call the stop() method on the object returned by sad()

Maybe you want sad() to explicitly be true, and not any truthy value.

no, shouldn't it be
this.life()

you only get to loop once.

> yolo - you only loop once
for(int i = 0; i < 1; ++i)
this.live()

>just b urself xD

>just stop being depressed!!

Why the fuck are you wrapping a statement that only gets executed once into a loop that only loops once?

=== doesn't convert types

It's supposed to be a joke about yolo.

> not getting the obvious joke
user, you really need to go to sleep / go out for a walk / drink coffee

This is the most freshman CS student shit I've ever seen. Fucking kill yourself OP.

=== compares types while == only compares the values. So if (4== '4') would evaluate to true, but if (4 === '4') would evaluate to false.

I got the joke, I guess the humor was lost on me, because I know people who would actually write that type of code seriously.

>===
Fucking javascript

I have no depth or insight, so I translated some quotes I found on life:

pay_taxes();
int16_t life;


prop_life = all tragic events && comic (mconcat events)

double Life::Score() {
double money = std::accumulate(earnings.begin(), earnings.end(), 0);
double happiness = totalHappiness();
double renown = std::abs(this.fame);

return happiness;
}

If totalHappiness() is a method rather than a variable, it should be getTotalHappiness().

It's a variable that happens to be a function.

Or something. I dunno.

If it was a variable then you shouldn't have the parentheses. You'd just have to define it as totalHappiness = function() {return "fuck nice things";} or whatever

he would still need the parentheses

Ah shit, you're right. My bad.

>sad().stop();
>true.stop();

loving the implications

why do people who make these feel the necessity to demonstrate they have no idea how programming works.

whats wrong with oop

this.

If sad is a function returning a bool, then the next line would throw an exception, since bools don't have methods.

If sad is returning an object, it'll be comparable to "true", but not exactly true so the control flow never goes into the if statement.

how does a boolean have a function like that.

That's the rule you made up. In Qt, for example, by convention, there's no get. Qt has text() as getter and setText() as setter.

C====
C 4 equality
patriarchal languages can go die

>since bools don't have methods
> Boolean.prototype.you = function() { return 'wrong'; }
- function () { return 'wrong'; }
> true.you()
- "wrong"