this post was submitted on 20 May 2026
1301 points (99.9% liked)

Programmer Humor

31506 readers
1924 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
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] testaccount789@sh.itjust.works 2 points 4 hours ago (1 children)

I tested it, it works as it is.

#include <stdio.h>
#include <stdbool.h>

void main(){
        bool true_or_false = true;
        if(true_or_false){
                goto if_true;
        }
        printf("This code runs only if false.\n");
        goto end_false_if;
if_true:
        printf("This code runs only if true.\n");
end_false_if:
        printf("This code always runs.\n");
}

If true, it jumps to if_true, then runs other code. If false, the if gets skipped, if false code gets run, then it skips over if true code.

[โ€“] lukstru@piefed.social 2 points 4 hours ago

I totally did the thing where I commented without reading properly before. Sorry!