The worst D code you'll ever see

Basile B. b2.temp at gmx.com
Wed Jan 16 01:52:09 UTC 2019


On Tuesday, 15 January 2019 at 10:55:02 UTC, bauss wrote:
> I think I just wrote the worst D code in existence.
>
> https://www.reddit.com/r/badcode/comments/aftpcf/bad_code_coding_challenge_2_primes_between_x_and_y/ee41he6/
>
> What it does is find prime numbers between X and Y and adds 
> them to an array.
>
> It's part of a coding challenge to write bad code, but figured 
> I'd share here.
>
> It's rare I see D used in contests, so I figured I would use it 
> for this one.
>
> Enjoy the cringe.

You could have make and conditional expr with `true` and `false`, 
instead of

     n >= 2 && number1 != number2 && number1 < number2

this beginner crap:

     n >= 2 == true && (number1 == number2) == false && number1 < 
number2 == true

for example. There's probably more to do with relational and 
conditional expr but then it becomes ambiguous: bad code or 
obfuscation ?


More information about the Digitalmars-d mailing list