this post was submitted on 18 Feb 2024
522 points (100.0% liked)

Programmer Humor

21875 readers
248 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Insert <it's not much but it's honest work> meme. It only supports ints and bools, some logic and simple arithmetics and it compiles to Java but damn was it hard to get that far.

Can you guess what everything does?

you are viewing a single comment's thread
view the rest of the comments
[–] bleistift2@feddit.de 64 points 1 year ago* (last edited 1 year ago) (3 children)
class Scratch {
  // Start of file

  public static void main(args: string[]) {
    int number1 = 2;
    number 1 = 10;
    int number2 = 13;
    boolean fo_sure = true;
  
    if (fo_sure) {
      number1 = number1 + 5 - 10 * 2 / 3;
    }
  
    System.out.println(number1);
  
    boolean canYouSeeMee = false;
    System.out.println(canYouSeeMe);
    if (false) {
      canYouSeeMe = false;
    } else {
      canYouSeeMe = true;
    }
    System.out.println(canYouSeeMe);
  } 
}

What’d I win?

I find it interesting and unnerving that I understood the code, but not the youthspeak.

[–] prof@infosec.pub 32 points 1 year ago

Well done, here's your price: 🏅

You may redeem it for a star on a GitHub repo of your choice.

It all gets put into the main method though in this version 😄

[–] RedditWanderer@lemmy.world 6 points 1 year ago (1 children)
[–] bleistift2@feddit.de 5 points 1 year ago (1 children)

There are even more optimization possibilities, but I wanted to stay as close to the original as possible.

[–] Buddahriffic@lemmy.world 1 points 1 year ago

Yeah, it can be optimized down to a single constant print statement.

[–] steersman2484@sh.itjust.works 1 points 1 year ago (1 children)

Isn't the second if condition false?

[–] bleistift2@feddit.de 1 points 1 year ago

Thanks, I corrected it.