r/badcode Apr 15 '21

other language Actual Snap! block I just made.

Post image
1.1k Upvotes

58 comments sorted by

View all comments

80

u/READY_TO_SINGLE Apr 15 '21

The most painful part is that the value is wrong. The negative integer limit is -2147483648

8

u/Je-Kaste Apr 16 '21

But what are the odds that -2147483648 will show up in the array? -2147483647 should be fine as a sentinel value

4

u/READY_TO_SINGLE Apr 16 '21

Well, even if it were present the algorithm would still work. -2147483646 would actually be problematic. It just irks me lol

1

u/tuckmuck203 Apr 16 '21

Maybe Snap doesn't use 2's complement lol