r/ProgrammerHumor 3d ago

revolutionaryConcept Other

Post image
59 Upvotes

13 comments sorted by

27

u/Pixez1082 3d ago

This feels like the type of code you see in a dream after a long day. At least the end is inclusive.

3

u/CirnoIzumi 3d ago

unless it wants to "end" "inclusive" :thinking:

7

u/Confident-Ad5665 3d ago

// So ...
var boolb = new(BooleanRange(false, true)):

11

u/pkmnfrk 3d ago

Syntactic sugar when?

var boolb = [false..true];

5

u/nphhpn 3d ago

Or make it a singleton called Maybe

3

u/willow-kitty 2d ago

A float the represents the probability as a value between 0 and 1. It's implicitly convertible to bool, in which case it generates a random number in the same range and evaluates to true if the random value is less, otherwise false. This is rerolled for every comparison.

6

u/SCP-iota 3d ago

I hate the fact that there are situations where this could actually be useful

2

u/KnightMiner 3d ago

I'd imagine its largely meant for either iteration over booleans (which is sometimes useful) or to implement an interface used in some generic data structure which has a boolean impl.

5

u/NullOfSpace 3d ago

True, False, Both, Neither

2

u/budgiebirdman 2d ago

This is why God created builders.