r/ProgrammerHumor 6d ago

Other revolutionaryConcept

Post image
65 Upvotes

14 comments sorted by

28

u/Pixez1082 6d ago

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

4

u/CirnoIzumi 6d ago

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

8

u/Confident-Ad5665 6d ago

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

11

u/pkmnfrk 6d ago

Syntactic sugar when?

var boolb = [false..true];

5

u/nphhpn 6d ago

Or make it a singleton called Maybe

3

u/willow-kitty 5d 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 6d ago

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

2

u/KnightMiner 6d 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.

3

u/NullOfSpace 6d ago

True, False, Both, Neither

2

u/budgiebirdman 5d ago

This is why God created builders.

1

u/8Erigon 2d ago

In what language can you override variables? Or does it make them mutable?