[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


Which way, g?
>>
whatever my AI tells me
>>
>>109384832
return !!a;
>>
>>109384832
return !a;
>>
>>109384832
Obviously (assuming we already have an error factory

import equals0 from "pajeetDev/math tools"
function checkIfNumberIsEqualToZero(nSomeNumber: number){const result=equals0(nSomeNumber);
if(result===true) return true
else if(true){
return false;
} else {throw errorFactory("could not check equals for 0")}
}
>>
second is like a boss
>>
>>109384892
PS the formatting is correct like that because obviously you use an opinionated formatter that absolves you from taking agency in your code style
>>
if ((a == 0) == true) return true; else if ((a != 0) == true) return !true;
>>
>>109384891
Sadly doesn't work in every language, which really bothered me
>>
>>109384832
return rand.nextInt(2) == 1;
>>
class TrueFactory():
def get_value(self):
return True

class FalseFactory():
def get_value(self):
return False

class IntegerValidator():
def validate(self, x):
if x == 1:
return 1
elif x == 0:
return 0
else:
raise Exception(f"{x} cannot be marshalled into a boolean value. 0 = true, 1 = false.")

class BooleanValueParser():
def __init__(self):
self.true_factory = TrueFactory()
self.false_factory = FalseFactory()
self.validator = IntegerValidator()

def marshal_boolean(self, x):
x = self.validator.validate(x)
if x == 0:
return self.true_factory.get_value()
else:
return self.false_factory.get_value()
>>
>>109384911
second is when u think like a brilliant
>>
>>109384832
>Ugly AI slop pajeet OP
>Irrelevant, time wasting question
>>
>>109384832
depends on if a==0
>>
>>109385031
return a == 0;

but it's just engagement farming, giving two retarded answers to make people answer with the obvious, boom engagement
>>
>>109385097
The ONLY valid answer in this entire fucking thread full of brown nocoders !!11111111

HANG YOURSELVES
>>
>>109385097
There should be an AbstractBooleanFactory which TrueFactory and FalseFactory derive from. Consider also using a proxy class for the Boolean value itself. The idea is to be implementation transparent.
>>
>>109384832
>jeet
>jeet with sunglasses
neither
>>
>>109385864
>>109385097
Also, implement a web API. It's 2026 for fucks sake
>>
>>109384869
/thread
>>
>>109384869
FPBP, in the age of AI op's pic comes across as facebook boomer tier
literally who the fuck cares anymore? programming is over
>>
>>109384869
Truth
>>
>>109386238
>web API
>2026
You mean an MCP
>>
>>109385097
Enterprise grade stuff.
>>
>>109385097
A classic

https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>
if that language is strongly typed you may not be able to implicitly convert an integer to a boolean.
>>
Doesn't matter, the compiler will turn it all into AND rax,rax or something
>>
I think the solution in which the guy has glasses might be better because the guy looks cooler



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.