Svetlin Ralchev's Blog

Software Developer Adventures

Funny C# Code

Posted by Svetlin Ralchev on August 11, 2009

Even though I don’t know the author of the lines below I would say “Thank you man”. I recieved them today on skype by one of my ex-collegues.

        try

        {

        HOME:

            do

            {

                Play(“World of Warcraft”);

            }

            while (!asleep);

 

            Thread.Sleep(12 * 60 * 60 * 1000);

 

            WakeUp(coffee);

 

            if (you_still_give_a_shit())

                goto WORK;

            else

                goto OUT;

 

 

 

        WORK:

            do

            {

                if (got_something_to_do())

                {

                    LookAtTheMonitor();

                    Press_Some_Keys(new string[] { “Ctrl+C”, “Ctrl+V” });

                }

 

 

 

                Browse(“vbox7.com”);

                Browse(“topsport.bg”);

                Browse(“youtube.com”);

 

                Have_a_Break();

                Have_a_Kitkat();

 

            }

            while (DateTime.Now.Hour < 5);

 

 

 

            if (DateTime.Now.Day == 1)

            {

                // at least

                GetSomeCash(3000);

            }

 

 

 

        OUT:

            switch (mood)

            {

 

                case Mood.Horny:

                    ChaseChicks(“hot!”);

                    break;

                case Mood.Dull:

                    SmokeSomeStuff(new Stuff[] { “Grass”, “Serious Stuff” });

                    break;

                default:

                    DrinkBeer(5);

                    break;

 

            }

            goto HOME;

 

        }

        catch (HealthException x)

        {

            SeeTheDoctor(x);

        }

        catch (NoMoneyException)

        {

            ShitHappens();

        }


10 Responses to “Funny C# Code”

  1. This site rocks!

  2. Excellent site, keep up the good work

    • Svetlin Ralchev said

      Thanks, Bill. Good luck to you.

  3. Java said

    You should add:

    case Mood.Smart:
    learnJava();
    return Mood.Happy;

    :P

    • hahahaha :) so only java developers are smart?!

    • Heath-Hunter said

      return Mood.Happy;

      warning CS0162: Unreachable code detected
      :)

  4. vlood said

    Dude, you don’t need “break;” in the two first cases… and in fact you don’t need it after default case, as it is the last one :)

    • I haven’t written the code above, but why I don’t need ‘break’. I think that only in case of ‘return’ I don’t need it.

      • vlood said

        After chasing chicks you might feel a little dull (not necessarily, but possible) and it would be nice to continue checking the mood for any other cases. Will you go directly home, if you feel dull after chasing chicks? Or even if not, will you go home without having several beers?

        My suggestion is to remove “break;”, to go through all the cases, or move “DrinkBeer(5);” out of the switch construction, that way ensuring you won’t miss the important part of the evening ;)

        Cheers!

      • ahh sorry I was too tired when I read your words. Now I understood what you mean. Yeah, we can’t live without bere. By the way the code above has unknown author.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>