139
you are viewing a single comment's thread
view the rest of the comments
[-] TwilightKiddy@scribe.disroot.org 3 points 21 hours ago

Yes, you would do goto case 42;
From MSDN:

private static decimal CalculatePrice(CoffeeChoice choice)
{
    decimal price = 0;
    switch (choice)
    {
        case CoffeeChoice.Plain:
            price += 10.0m;
            break;

        case CoffeeChoice.WithMilk:
            price += 5.0m;
            goto case CoffeeChoice.Plain;

        case CoffeeChoice.WithIceCream:
            price += 7.0m;
            goto case CoffeeChoice.Plain;
    }
    return price;
}
this post was submitted on 21 Sep 2026
139 points (99.3% liked)

Programmer Humor

33314 readers
499 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 3 years ago
MODERATORS