Sing Happy Birthday to your favourite programming language

119

22

Your favourite programming language has just had a birthday. Be nice and sing it the Happy Birthday song.

Of course you should accomplish this by writing a program in that language. The program takes no input, and writes the following text to the standard output or an arbitrary file:

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear [your favourite programming language]
Happy Birthday to You

You should substitute the bracketed part (and omit the brackets).

This is a code golf — shortest code wins.

UPDATE

I'm glad that the question aroused great interest. Let me add some extra info about scoring. As stated originally, this question is a code golf, so the shortest code is going to win. The winner will be picked at the end of this week (19th October).

However, I'm also rewarding other witty submissions with up-votes (and I encourage everybody to do so as well). Therefore although this is a code-golf contest, not-so-short answers are also welcome.

Results

Congratulations to Optimizer, the winner of this contest with his 42 byte long, CJam submission.

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 39752; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/<a/.test(lang)) lang = jQuery(lang).text();
    
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang > b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

David Frank

Posted 2014-10-13T11:15:15.893

Reputation: 1 933

12guys! Happy Birthday song is now in public domain!! – Optimizer – 2015-09-23T10:01:41.610

4At least one of the answers prints a leading newline. Is that allowed? – Dennis – 2016-06-19T21:32:31.070

Possible duplicate of We're no strangers to code golf, you know the rules, and so do I

– Blue – 2016-07-03T13:24:48.943

Hmm.. if anyone posts more than one answer to this question, they must be lying. It says to use your favorite programming language. – 12Me21 – 2018-03-10T21:22:48.723

It's 6 months to and from its birthday. Singing such is quite strange – l4m2 – 2018-03-12T01:16:52.400

"Tasks that depend on a language's name are a form of disadvantaging some languages by arbitrary criteria." -- quote Martin Ender from this closed challenge.

– user202729 – 2018-06-26T08:26:14.783

2Can we count the name of the programming language as one byte because it would only seem fair to people coding in a long-winded language such as JavaScript vs. someone doing it in C. We are really looking for most creative logic right? – MonkeyZeus – 2014-10-13T18:49:37.790

1@MonkeyZeus Sorry, but taking length differences into account is intended. Since you don't have to be the shortest to gain popularity points, it shouldn't matter too much. There is also a tendency that programs written in a programming language that has a longer name, need less characters to implement the same functionality. – David Frank – 2014-10-13T19:02:38.213

I am no cross-programming guru but if 2 languages happen to achieve the goal in the same amount of logic bytes then it's kind of like getting penalized for getting your coffee from a "coffee shop" compared to a "café". Disclaimer: I am not a coffee connoisseur. – MonkeyZeus – 2014-10-13T19:51:12.507

14

Why all the upvotes for this despite all the downvotes for the Bonbon song? This is just as boring a challenge.

– xnor – 2014-10-14T07:15:27.617

1@DavidFrank "Sorry, but taking length differences into account is intended. Since you don't have to be the shortest to gain popularity points, it shouldn't matter too much." Um, it's code golf, not a popularity contest. Votes are irrelevant and the shortest program wins. So you are being penalized for, e.g., writing in Microsoft Visual C++ rather than vanilla C (though, in that case, it's probably deserved). – David Richerby – 2014-10-14T12:40:32.133

10

I should probably mention that the song is copyrighted and distributing these programs may cause a DMCA

– ratchet freak – 2014-10-14T14:38:53.230

1@DavidRicherby I'm sorry that the rules are not to your liking. I think this is more or less widespread practise to include the programming language name in the solution. Votes are not irrelevant (you gain xp by votes), though you might not win the contest. However, you have a free choice in your favourite programming language. In this contest not only solutions but also programming languages compete. – David Frank – 2014-10-14T16:07:28.417

@xnor Not sure, but people seem to like it any time you make them put their language name in the output.

– Calvin's Hobbies – 2014-10-14T16:34:52.403

1With the sheer number of answers, this seems to be more of a pop-con than code golf... How are you going to be able to find the shortest answer? – Beta Decay – 2014-10-17T17:56:27.763

@BetaDecay. Sorry i don't know the full etiquette yet. Comment deleted. – Hoki – 2014-10-18T12:25:46.353

1@xnor Because the Bonbon song never made it to the HNQ. – Martin Ender – 2014-10-23T10:55:21.940

Answers

47

CJam, 46 42 bytes

"Happy Birthday to You
"___F<"Dear CJam
"@

How it works:

"Happy Birthday to You
"___                          "Push "Happy Birthday to You\n" string to stack 4 times";
    F<                        "From the last string, take only first 15 characters. F is a";
      "Dear CJam              "preinitialized variable whose value is 15";
"                             "Push "Dear CJam\n" to stack";
 @                            "Take the third string from end and put it to end";

This leaves the stack as following at the end of the code:

["Happy Birthday to You
" "Happy Birthday to You
" "Happy Birthday " "Dear CJam
" "Happy Birthday to You
"]

which are printed automatically to output as

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear CJam
Happy Birthday to You

Try it here (Copy the code and run it)

Optimizer

Posted 2014-10-13T11:15:15.893

Reputation: 25 836

1does the "first 15 characters" thing come from the F? is that how it knows the number 15? – vijrox – 2015-06-30T21:33:32.963

1Yeah, a-f are 10-15. – Jacob – 2015-07-01T03:31:38.233

122

LOLCODE: 109 (105 with "correct" spelling)

LOLCODE is not a great language for golfing, especially since you lose all the beauty and expressiveness when shortening the code.

HAI
H R "HAPPY BIRTHDAY "
T R SMOOSH H "TO YOU"
VISIBLE T
VISIBLE T
VISIBLE SMOOSH H "DEAR LOLCODE"
VISIBLE T

Test it using loljs

This is my preferred rendition, weighing in at 187 characters (spaces added for clarity):

HAI
H R "HAPPY BERFDAY "
IM IN YR LOOP UPPIN YR N TIL BOTH SAEM N AN 4
  VISIBLE H!
  BOTH SAEM N AN 2, O RLY?
    YA RLY
      VISIBLE "DEER LOLCODE"
    NO WAI
      VISIBLE "2U"
    OIC
IM OUTTA YR LOOP
KTHXBAI

i alarmed alien

Posted 2014-10-13T11:15:15.893

Reputation: 1 321

15I just knew there'd be a LOLCODE answer to this. BTW, kan u wryt n lwrcase insyd t kwotez? KTHXBYE. – Level River St – 2014-10-15T18:38:59.867

2I tried writing a LOLCODE answer to another challenge a while back, but it's too verbose for code golfing, and it lacks decent data structures and the ability to create complex functions, so that rather limited my efforts! – i alarmed alien – 2014-10-16T20:30:51.600

3This answer has given me an urge to download LOCODE and actually learn it properly. – Pharap – 2014-10-18T05:53:54.820

2This is great!! – AStopher – 2014-10-20T15:35:26.050

89

Mathematica- barcode birthday wishes--way too many bytes

This prints the verses and reads them aloud.

happy birthday

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear Mathematica
Happy Birthday to You

StringReplace replaces each comma with a NewLine. Barcodes cannot contain control characters.

DavidC

Posted 2014-10-13T11:15:15.893

Reputation: 24 524

11I actually scanned this with a QR code reader. It has extra spaces after every comma, couldn’t you save bytes if you— oh, wait. Never mind. – Timwi – 2016-01-08T17:41:39.600

13I can't see a barcode button on my keyboard! How can I test this? – matsjoyce – 2014-10-20T15:49:05.320

17I love that there's a 10 in the barcode (bottom right corner), seeing that BarcodeRecognize was introduced in Mathematica 10. ^^ – Martin Ender – 2014-10-23T10:54:06.943

Yes! I hadn't noticed that. – DavidC – 2014-10-23T12:49:30.733

55

TI-Basic, 53 bytes

Well, since everyone is putting their favorite programming language up, I might as well add one of my old favorites. I spent a lot of time over the years (before I graduated to actual programming languages) typing commands into a window half the size of a smart phone.

"HAPPY BIRTHDAY TO YOU
Disp Ans,Ans,sub(Ans,1,15)+"DEAR TI-BASIC
Ans

My calculator doesn't support lowercase letters, and the only variables that can be strings are Str1, Str2 etc.

Stretch Maniac

Posted 2014-10-13T11:15:15.893

Reputation: 3 971

There are lowercase letters on your calculator, but typing them in is nontrivial and they take 2 bytes each. – lirtosiast – 2015-06-07T00:22:18.320

TI-BASIC commands are one-/two-byte tokens, so this would be 63 bytes. Also, as Thomas Kwa said, you technically do have lowercase letters, but you can't access them under normal conditions (you can write an assembly program and convert it to machine code to be run with AsmPrgm that messes with the system flags and allows you to type lowercase letters) – M. I. Wright – 2015-06-15T22:15:15.780

Once I tried to write a Pong program in my TI-84 Plus, but gave up due to the sheer scale of the program and small display size. – LegionMammal978 – 2015-07-03T00:37:42.540

Which flavor of TI-Basic? I got really familiar with it on the TI-84. – Jesan Fafon – 2014-10-14T16:38:58.187

7Always nice to see TI-Basic. This appears to be standard 8x TI-Basic, where any expression is automatically stored to Ans, which can be used a weird and hard-to-follow optimization strategy. I also got started programming with this awesome language. – codebreaker – 2014-10-14T18:44:13.387

4Note to editors: can you post any changes (in this case loss of 8 chars) in the comments rather than just editing it? That would make me feel like this is still my answer. – Stretch Maniac – 2014-10-14T19:58:20.113

2+1!! that's how i learned to program too. I built Tron for the TI-83 :D it was quite slow though, thus not fun. – Nacht - Reinstate Monica – 2014-10-15T22:42:37.770

2Haha that's awesome. I made a Blackjack game for the TI-83. In the process I learned all the rules of Blackjack quite intimately. – thomasrutter – 2014-10-18T22:08:36.580

This brings back fond memories of programming on my TI-83. I'm sad I lost it during my undergraduate... would be fun to go look at the stuff I had written 15 years ago now (damn that's a long time ago). – enderland – 2014-10-20T02:42:17.827

44

Sed, 60 55 bytes

(1 character added because there is no way to make sed to work without input.)

s/^/Happy Birthday To You/
h
G
G
G
s/To You/Dear sed/3

Certainly not a winner, posted to demonstrate sed's rare s/// feature of replacing just the nth occurrence.

bash-4.3$ sed 's/^/Happy Birthday To You/;h;G;G;G;s/To You/Dear sed/3' <<< ''
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear sed
Happy Birthday To You

Sed (shorter but not interesting): 52 characters

s/^/Happy Birthday To You/
h
G
p
s/To You/Dear sed/

Sample run:

bash-4.3$ sed 's/^/Happy Birthday To You/;h;G;p;s/To You/Dear sed/' <<< ''
Happy Birthday To You
Happy Birthday To You
Happy Birthday Dear sed
Happy Birthday To You

manatwork

Posted 2014-10-13T11:15:15.893

Reputation: 17 865

The shorter answer appears to be 51 bytes, rather than the 52 you have listed – Taylor Scott – 2018-07-26T14:54:39.287

1@TaylorScott, the explanation at the top applied there too: “(1 character added because there is no way to make sed to work without input.)”. – manatwork – 2018-07-26T15:10:21.980

Ahh, that makes sense :) – Taylor Scott – 2018-07-26T15:13:29.290

7sed answers are always winners IMO :) – Digital Trauma – 2014-10-13T16:42:30.583

30

C, 73 bytes

main(c){for(;c-5;)printf("Happy Birthday %s\n",++c-4?"To You":"Dear C");}

V-X

Posted 2014-10-13T11:15:15.893

Reputation: 747

Insignificant bug: should be i++-3. (Currently the “Dear c” appears in the 2nd line.) (While using a single variable, I would name it “c”.) – manatwork – 2014-10-13T16:02:30.773

constant fixed, variable changed. Any idea to shorten the code? – V-X – 2014-10-13T16:08:08.753

Sorry, no idea to shorten it. C is not my strength. (I found the bug because even your current score is so unbelievable to me that I had to try it out. ;) ) – manatwork – 2014-10-13T16:16:43.500

12Shouldn't it be "Dear C" (uppercase)? – TRiG – 2014-10-14T10:35:54.710

I miss also the interpunction characters there... – V-X – 2014-10-14T10:50:05.380

27

Python, 61 60 59

H="\nHappy Birthday to You"
print(H*3)[:60]+"Dear Python"+H

Falko

Posted 2014-10-13T11:15:15.893

Reputation: 5 307

1You can save 1 byte - H="\nHappy Birthday to You" and print(H*3)[:59]+" Dear Python"+H – Stretch Maniac – 2014-10-13T16:37:33.123

@StretchManiac: Nice, thanks! (I guess if my trailing newline was ok, the preceding one is ok as well...) – Falko – 2014-10-13T16:47:29.673

1Is this python 2.7 or 3? – George – 2014-10-13T20:56:44.110

2@George: Python 2.7, as it has no brackets around the print argument. – Falko – 2014-10-13T20:59:59.400

1Does output from an interactive interpreter count? h="\nHappy Birthday to You";(h*3)[:60]+"Dear Python"+h – threed – 2014-10-15T22:54:19.413

1You can save one more by removing the space before Dear and changing 59 to 60. – threed – 2014-10-15T22:55:14.553

@threed: Thanks, that's great! But no, I don't think the interactive interpreter counts. – Falko – 2014-10-15T23:10:54.247

26

sh, 52

H()(echo Happy Birthday ${@-to You});H;H;H Dear sh;H

Digital Trauma

Posted 2014-10-13T11:15:15.893

Reputation: 64 644

3With default value parameter expansion just 53 characters: H()(echo Happy Birthday ${@:-to You});H;H;H Dear sh;H. – manatwork – 2014-10-13T16:07:56.410

Ooh very good @manatwork! – Digital Trauma – 2014-10-13T16:12:53.823

2You can omit the colon in the parameter expansion - that works if the parameter was never set, while :- also covers cases when it is set but empty – None – 2014-10-13T19:34:32.910

@professorfish Nice - thanks, I didn't know that! – Digital Trauma – 2014-10-13T21:18:43.567

@DigitalTrauma A good place to look if you need to save characters is http://wiki.bash-hackers.org/syntax/pe - there's a list of all parameter expansion syntax

– None – 2014-10-14T07:23:42.170

22

ArnoldC, 228 bytes

Lets make Arnold Schwarzenegger singing...

IT'S SHOWTIME
TALK TO THE HAND "Happy Birthday to You"
TALK TO THE HAND "Happy Birthday to You"
TALK TO THE HAND "Happy Birthday Dear ArnoldC"
TALK TO THE HAND "Happy Birthday to You"
YOU HAVE BEEN TERMINATED

output:

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear ArnoldC
Happy Birthday to you

Wasi

Posted 2014-10-13T11:15:15.893

Reputation: 1 682

1Invalid input '\', expected '"' (line 2, pos 40) – r3mainer – 2014-10-15T21:58:57.813

@squeamishossifrage lol, fixed. – Wasi – 2014-10-16T05:34:24.363

16Perhaps you can add an Ahnold lisp! Hahpy Birfday reduces character count by 4. – Compass – 2014-10-16T19:27:14.760

20

APL (48)

↑1⌽'Happy birthday '∘,¨(3/⊂'to you'),⊂'dear APL'

marinus

Posted 2014-10-13T11:15:15.893

Reputation: 30 224

Three bytes shorter: ↑'Happy birthday '∘,¨⌽4⍴3⍴'to you' 'dear APL'

– Adám – 2016-06-20T10:38:34.467

it takes fewer bytes than APL's own age :) http://www.dyalog.com/50-years-of-apl.htm

– ngn – 2016-11-28T18:38:13.353

Tested successfully at TryAPL

– iyrin – 2014-10-17T19:31:29.800

19

Shakespeare Programming Language, 3429 bytes

no one is going to be demented enough to enter a challenge with SPL, so...

My own words, a while ago. And yet, someone was demented enough to do it. Yes, yes, I know. Too much bytes. But SPL deserves to be included here, I think. And believe me, I've done a gargantuan effort to "golf" this program, which is why it's a bit repetitive and uses mostly the same words (I could always have followed DLosc's suggestion, but that would be too extreme even for me).

A Happy Birth Day

Ajax, a hero
Ford, a man

          Act I: 1

          Scene I: 1

[Enter Ajax and Ford]

Ajax:
 You are nothing!

          Scene II: 2

Ford:
 Am I nicer than the sum of a big cow and a son?

Ajax:
 If so, we shall go to Scene V. You are as big as the sum of thyself and a cat!

          Scene III: 3

Ford:
 You are as red as the sum of a big red warm rich bold fair cat and a big rich fine son.
 Speak thy mind! You are as big as the sum of thyself and the sum of a cute fair fine
 rich cat and a hog! Speak thy mind! You are as big as the sum of thyself and the sum
 of a cute fair fine rich cat and a hog. Speak thy mind. Speak thy mind! You are as bold as
 the sum of thyself and the sum of a big fine fair cat and a cow. Speak thy mind! You are
 as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the sum of
 thyself and the sum of a red old fair fine tiny cow and a big joy. Speak thy mind.
 You are as red as the sum of thyself and the sum of the sum of a red old fair fine
 tiny cow and a rich old red sky and a pig. Speak thy mind! You are as old as the sum
 of thyself and the sum of a big fine fair joy and a son. Speak thy mind. You are as
 red as the sum of thyself and a cute son. Speak thy mind! You are as cute as the sum
 of thyself and the sum of a bad fat vile pig and a fat bad lie. Speak thy mind! You are
 as fat as the sum of thyself and a vile evil war. Speak thy mind! You are as vile as the
 sum of thyself and the sum of a pig and a toad. Speak thy mind! You are as fair as the
 sum of thyself and the sum of a big fair hard fine son and a red fine fair joy. Speak
 thy mind! Are you as old as a big cow?

Ajax:
 If so, we shall go to Scene IV.

Ford:
 You are as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the sum
 of thyself and the sum of the sum of a big red warm rich bold fair cat and a red old fair
 fine tiny cow and a bad hog. Speak thy mind! You are as big as the sum of thyself and the
 sum of a fat bad hog and a war. Speak thy mind! You are as big as a red old fair fine tiny
 cow. Speak thy mind! You are as old as the sum of thyself and the sum of a big red warm
 rich bold fair cat and a fat foul bad hog and a son. Speak thy mind. You are as fat as
 the sum of thyself and the sum of the sum of a big fair hard fine son and a big fine
 fair joy and a bad pig. Speak thy mind. 

Ajax:
 Let us return to Scene II.

          Scene IV: 4

Ford:
 You are as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the
 sum of thyself and a big red warm rich bold fair cat and a warm sky. Speak thy mind.
 You are as fat as the sum of thyself and the sum of a red old fair fine tiny cow and a
 cat. Speak thy mind. You are as fat as the sum of thyself and a bad foul hog. Speak
 thy mind. You are as cute as the sum of thyself and the sum of a big fair hard fine
 son and a sky. Speak thy mind. You are as big as a red old fair fine tiny cow. Speak thy
 mind! You are as old as the sum of thyself and the sum of thyself and the sum of the sum
 of the sum of a red old fair fine tiny cow and a big fair hard fine son and a big joy and
 a son. Speak thy mind. You are as bad as the sum of thyself and the sum of a fat pig and a
 hog. Speak thy mind. You are as fat as the sum of thyself and a lazy pig. Speak thy mind.

Ajax:
 Let us return to Scene II.

          Scene V: 5

[Exeunt]

The meaning of all this?

OK, if you're curious about how all of this is supposed to work, let me try and explain my reasoning. Firstly, the variables. They have to come from Shakesperian plays and, since tharacter count is important, we have to choose the small ones; thus, Ajax and Ford appear. They need a description after being declared (which is ignored, but still); I could've used a single letter, but heh.

Act I, Scene I

var Ajax, Ford; Ford = 0;

We bring the variables into the stage and make Ajax tell Ford that his value will be 0.

Act I, Scene II

if (Ford > 2*1+1) goto Scene V; Ford = Ford + 1;

OK, if the value stored in Ford is bigger than 3, the program jumps to Scene V; otherwhise, its value is incremented.

Act I, Scene III

Ford = 2*2*2*2*2*2*1+2*2*2*1; print((char) Ford); Ford = Ford+2*2*2*2*1-1; print((char) Ford); Ford = Ford+2*2*2*2*1-1; print((char) Ford); print((char) Ford); Ford = Ford+2*2*2*1+1; print((char) Ford); Ford = 2*2*2*2*2*1; print((char) Ford); Ford = Ford+2*2*2*2*2*1+2*2*2*1+(-1); print((char) Ford); Ford = Ford+2*2*2*1+1; print((char) Ford); Ford = Ford+2*1; print((char) Ford); Ford = Ford+2*2*2*(-1)+2*2*(-1); print((char) Ford); Ford = Ford+2*2*(-1); print((char) Ford); Ford = Ford+2*(-1)+(-1); print((char) Ford); Ford = Ford+2*2*2*2*1+2*2*2*1; print((char) Ford); if (Ajax == 2*1) goto Scene IV; Ford = 2*2*2*2*2*1; print((char) Ford); Ford = Ford+2*2*2*2*2*2*1+2*2*2*2*2*1+2*(-1); print((char) Ford); Ford = Ford+2*2*(-1)+(-1); print((char) Ford); Ford = 2*2*2*2*2*1; print((char) Ford); Ford = Ford+2*2*2*2*2*2*1+2*2*2*(-1)+1; print((char) Ford); Ford = Ford+2*2*2*2*1+2*2*2*1+2*(-1); print((char) Ford); Ford = Ford+2*2*2*1+2*-1; print((char) Ford); goto Scene II;

Loads and loads of lines. The idea is to fiddle with the value stored on Ford, doing loads and loads of arithmetic operations in order to get the ASCII number of the desired letters, then we tell the compiler to output the number in character form. That's how you write Happy Birthday. There's an if inside this scene: the idea is to check if this is the third phrase of the song; if it is, we jump to Scene IV; otherwise we keep on forward, to write to You. After that, we jump back to Scene II.

Act I, Scene IV

Ford = 2*2*2*2*2*1; print((char) Ford); Ford = Ford+2*2*2*2*2*2*1+2*2*1; print((char) Ford); Ford = Ford+2*2*2*2*2*1+1; print((char) Ford); Ford = Ford+2*2*(-1); print((char) Ford); Ford = Ford+2*2*2*2*1+1; print((char) Ford); Ford = 2*2*2*2*2*1; print((char) Ford); Ford = Ford+2*2*2*2*2*1+2*2*2*2*1+2*1+1; print((char) Ford); Ford = Ford+2*(-1)+(-1); print((char) Ford); Ford = Ford+2*2*(-1); print((char) Ford); goto Scene II;

The way this works is similar to the Scene above: the idea is to write Dear SPL.

Act I, Scene V

End.

Just like that.

I still haven't found any place where this can be tested, unfortunately...

Rodolfo Dias

Posted 2014-10-13T11:15:15.893

Reputation: 3 940

I think you should be able to repeat words, like fat fat fat fat cat. Also, I use https://github.com/drsam94/Spl/blob/master/splc.py to compile my spl code.

– clamchowder314 – 2016-03-24T20:54:04.290

16

Ruby, 54 bytes

I just thought "Hey, there's no Ruby answer yet", but then one appeared a few seconds before this one. Oh well...

puts h="Happy Birthday to You",h,h[0,15]+"Dear Ruby",h

Martin Ender

Posted 2014-10-13T11:15:15.893

Reputation: 184 808

16

Any love for PHP? 61 59 58 bytes

$s="
Happy Birthday";echo$t="$s to You","$t$s Dear PHP$t";

See it in action @ http://sandbox.onlinephpfunctions.com/

MonkeyZeus

Posted 2014-10-13T11:15:15.893

Reputation: 461

Actually, you could go shorter still by 1 character. <?=$t=($s="\nHappy Birthday")." to You","$t$s Dear PHP$t"; The close PHP tags are unnecessary, but you would need a semi-colon. – PaulSkinner – 2015-10-09T13:37:37.387

@PaulSkinner That's awesome! Which version of PHP are you using? I cannot get it to compile :( – MonkeyZeus – 2015-10-09T13:45:59.787

@FakeName but it's going to be my birthday in a few days :'( – MonkeyZeus – 2015-10-09T13:48:00.400

@MonkeyZeus 5.5.27 and seems to be working fine for me. Odd. – PaulSkinner – 2015-10-09T13:59:38.533

@PaulSkinner Can you try sandboxing it? http://sandbox.onlinephpfunctions.com/

– MonkeyZeus – 2015-10-09T14:55:01.223

@MonkeyZeus That sandbox doesn't allow you to include PHP opening tags, so the best I can show is: http://sandbox.onlinephpfunctions.com/code/30b2df7ef31035851d7fb272f962ea755e5c3414

– PaulSkinner – 2015-10-11T11:09:57.297

@MonkeyZeus Here you go: http://codepad.viper-7.com/qQnKXK

– PaulSkinner – 2015-10-11T11:13:54.543

1Replace the \n with an actual line break in order to save a char. – Christoph – 2017-04-21T11:04:40.937

@Christoph Nice catch, thanks! – MonkeyZeus – 2017-04-21T18:30:22.363

1Combine the assignment to $t with its first output: $s="\nHappy Birthday";echo$t="$s to You","$t$s Dear PHP$t"; – manatwork – 2014-10-14T12:57:27.110

@manatwork excellent suggestion, thanks! – MonkeyZeus – 2014-10-14T13:10:27.060

58No. There is no love for PHP. Ever. – Fake Name – 2014-10-15T04:22:01.980

Same number of bytes with short tags: <?=$t=($s="\nHappy Birthday")." to You","$t$s Dear PHP$t"?> – AmadeusDrZaius – 2014-10-18T19:12:10.037

15

I just can't decide on just one language :/

BrainBack: 68

4 ["Happy birthday ">2 ->![<0 "to You
"]<[<0 "Dear BrainBack
"]<1 -]

BrainBack is a mix between BrainFuck and Forth, made for a PCG challenge Mar 7, 2014

Extended BrainFuck: 79

{h|"Happy Birthday ">}{t|"to You
">}&h&t&h&t&h|"Dear Extended BrainFuck
">&h&t

EBF's birthday is Jul 16, 2010

Scheme: 96

(R5RS, Racket, R6RS REPL)

(map(lambda(e)(display"Happy Birthday ")(display(if e "to You\n" "Dear Scheme\n")))'(1 1 #f 1))

Scheme was born Dec, 1975 (NB: PDF)

Zozotez: 96

((:'R(\(l)(p'|Happy birthday |())(p(?(a l)'|to You|'|Dear Zozotez|))(?(d l)(R(d l)))))'(t t()t))

However, It feels more right doing this one in French (86):

((:'A(\(l)(p'|Joyeux anniversaire|())(p(a l))(?(d l)(A(d l)))))'(, , | Zozotez,| |.|))

Output:

Joyeux anniversaire,
Joyeux anniversaire,
Joyeux anniversaire Zozotez,
Joyeux anniversaire.

Zozotez' birthday is Jul 19, 2011

Sylwester

Posted 2014-10-13T11:15:15.893

Reputation: 3 678

4+1 for "Happy birthday dear Extended Brainfuck", probably the most laborious language name here. And yet the program is a fraction of the size of the equivalent for the parent language. And for Zozotez, which does indeed sound better in French, though in general I don't much like the way the French squeeze the person's name into an identical line for this song. – Level River St – 2014-10-13T23:42:26.470

In your Zozotez answer, it should be Joyeux anniversaire à Zozotez. – Beta Decay – 2014-10-17T18:00:38.103

2

@BetaDecay According to my (French) wife it should be without such preposition. French Wikipedia agrees.

– Sylwester – 2014-10-17T21:07:15.663

14

Deadfish (2610 2391 chars)

What's this? An output only challenge? Sound like it's a job for Deadfish!

iiisdsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiiiiiiiiiiiiiiiioddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiioiioiiioiiiiiiiiiiodddddddddddoddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiio

Unfortunately, because Deadfish only outputs integers, the code above outputs the ASCII representations of each character in the song.

If we use the specification that

Errors are not acknowledged: the shell simply adds a newline character!

then we can golf this down to 2391 chars:

iiisdsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiofdddddddddddddddddddddddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiiofdddddddddddddddddddddddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiiiiiiiiiiiiiiiioddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiioiioiiioiiiiiiiiiiodddddddddddofddddddddddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiooiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddddddddddddddsiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiioiioddddddddddddoddddodddoiiiiiiiiiiiiiiiiiiiiiiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddsdddddodddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddodddddddddddddddddddddddsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiioiiiiiio 

Note: Deadfish isn't actually my favourite language, but I couldn't resist :P. Also golfing in Deadfish is a fun puzzle on its own.

Sp3000

Posted 2014-10-13T11:15:15.893

Reputation: 58 729

19For certain values of "fun". – Charles Wood – 2014-10-15T20:12:35.047

13

JS, 83 bytes

h="Happy Birthday to You\n",console.log(h,h,h.replace("to You\n","Dear")+" JS\n",h)

or 79 bytes by @Ingo Bürk

h="Happy Birthday ",t="to You\n",console.log(h+t,h+t,h+"Dear Javascript\n",h+t)

or 71 bytes by @kapep

console.log(a=(b="Happy Birthday ")+"to You\n",a,b+"Dear Javascript\n",a)

or run on the console this page (42 bytes)

eval($("#answer-39759 code:first").text())

l2aelba

Posted 2014-10-13T11:15:15.893

Reputation: 231

>

  • [removed due to your edit] 2. There is no language called "JS", it's called "Javascript". Since it has to be printed, this matters. 3. It's pretty common to use the shorter prompt for output since Javascript can't print to stdout anyway. 4. There is no need for the trailing ;.
  • < – Ingo Bürk – 2014-10-13T13:48:16.063

    Fixed sorry @IngoBürk – l2aelba – 2014-10-13T13:49:27.037

    4Also, this is shorter: h='Happy Birthday ',t='to You\n';console.log(h+t,h+t,h+'Dear Javascript\n',h+t) (you can still use prompt to save even more) – Ingo Bürk – 2014-10-13T13:50:25.833

    11LOL at the last code piece .. :D – Optimizer – 2014-10-13T14:00:05.490

    @IngoBürk, if you change all + with , you can spare the space after “Birthday”. (That way you get the same length as with my best: console.log(['',t='to You\n',t,'Dear JavaScript\n',t].join('Happy Birthday ')). So no need to suggest this one.) – manatwork – 2014-10-13T14:07:02.030

    176: t='to you\n';console.log(h='Happy birthday',t+h,t+h,'dear JavaScript\n'+h,t) – NinjaBearMonkey – 2014-10-13T14:21:42.253

    171: console.log(a=(b="Happy Birthday ")+"to You\n",a,b+"Dear Javascript\n",a) – kapex – 2014-10-14T02:13:54.047

    3alert instead console.log, needs 2 more brackets but shorter: alert((t=(h="Happy Birthday ")+'to You\n')+t+h+'dear EcmaScript\n'+t) 69 – edc65 – 2014-10-14T15:32:08.963

    Unprotected console.log without hitting F12 in IE10-? Party's over. ;^) alert is probably better, though Crockford's going to be mad you didn't browser:true and window.alert it. – ruffin – 2014-10-16T17:43:35.367

    11

    R: 70 bytes

    Takes advantage of paste and vector recycling.

    writeLines(paste(rep("Happy Birthday",4),c(rep("to You",2),"Dear R")))
    

    bdzimmer

    Posted 2014-10-13T11:15:15.893

    Reputation: 111

    Reduced to 66 bytes \~`=rep;write(paste("Happy Birthday"~4,c("to You"~2,"Dear R")),"")` https://tio.run/##K/r/P6EuwbYotcC6vCizJFWjILEYSCp5JBYUVCo4ZRaVZKQkVirVmegkayiV5CtE5pcq1RnpKLmkJhYpBClpauooKWn@/w8A

    – Nick Kennedy – 2019-02-23T22:04:00.560

    cat(paste(rep("Happy Birthday",4),c(rep("to You",2),"Dear R"),'\n')) – germcd – 2014-10-13T21:01:50.777

    @germcd That doesn't quite work, since cat adds spaces between the strings. So you end up with a space at the beginning of each line except the first. – bdzimmer – 2014-10-14T03:34:14.457

    write(x,"") -> write(paste(rep("Happy Birthday",4),c(rep("to You",2),"Dear R")),"") 68 bytes. Here is my original solution with 73 p=paste;write(c(i<-p(h<-"Happy Birthday","to You"),i,p(h,"Dear R"),i),"") Vector recycling beats me again. – Vlo – 2014-10-16T14:58:26.247

    11

    T-SQL, 89 87 bytes

    Edit: Probably shouldn't be dredging these old things up, but I just noticed an obvious change to this to reclaim a couple of bytes.

    Using STUFF to remove unwanted parts of the string, the starting index is provided by the values in the FROM clause multiplied by 3

    SELECT STUFF('Happy Birthday to You  Dear SQL',N,8,'')FROM(VALUES(24),(24),(15),(24))S(N)
    

    MickyT

    Posted 2014-10-13T11:15:15.893

    Reputation: 11 735

    This is a brilliant SQL solution and a very nice trick! – BradC – 2018-01-11T15:50:08.290

    This one is nice! – TLama – 2014-10-20T23:16:59.007

    9

    GNU dc, 51

    [Happy Birthday to You]d[Happy Birthday Dear dc]rdf
    

    Digital Trauma

    Posted 2014-10-13T11:15:15.893

    Reputation: 64 644

    3I also tried with dc, but even the almost raw version is shorter: [Happy Birthday To You]d[Happy Birthday Dear dc]rdf 51 characters. – manatwork – 2014-10-13T16:11:35.197

    On a roll today @manatwork :) – Digital Trauma – 2014-10-13T16:14:58.147

    3I learned of the existence of dc today because of this post and it's excellent. – Caleb Paul – 2014-10-19T13:40:33.657

    9

    Perl - 58

    say"Happy Birthday ".($_?"Dear Perl":"To You")for(0,0,1,0)
    

    Run with:

    perl -E'say"Happy Birthday ".($_?"Dear Perl":"To You")for(0,0,1,0)'
    

    Just for fun:

    perl -E'for(<HappyBirthday{0,1,2,3}>){s/B/ B/;s/2/ Dear Perl\n/;print s/\d/ To You\n/r}'
    

    hmatt1

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 356

    6How about say"Happy Birthday $_"for("to You","Dear Perl")[0,0,1,0] ? – core1024 – 2014-10-14T20:47:17.607

    @core1024 I didn't know you could do that with arrays, that's awesome. Feel free to post as your own answer! – hmatt1 – 2014-10-20T23:54:17.657

    8

    Python 507 bytes

    print """
    H  a     p     py-  Bir  t   h    day  -to-Y ou=  Happy -  B irt       h     d   a y
    -  t    o -    Y  o u  =  H a     p  p   y   -  B   i   r  t h  d     a y     - D  e
    ar-P   ython   =Ha  ppy    -      Bir    t   hda    y   -to- Y   o   uHapp     y   -
    B  i  r     t  h    d      a      y  -   t   o -    Y   o  u =  H   a     p    p
    y  - B       i r    t      h      day  -to-Y o  u   =   H  a ppy   -       B   i   r
    """.replace("\n","").replace(" ","").replace("-"," ").replace("=","\n")[:92]
    

    Not winning any prizes ... but if you look at it carefully, there is some ASCII art:

    #  #     #     ###  ###  #   #    ###  ##### ###  ##### #  # ###       #     #   # #
    #  #    # #    #  # #  #  # #     #  #   #   #  #   #   #  # #  #     # #     # #  #
    ####   #####   ###  ###    #      ###    #   ###    #   #### #   #   #####     #   #
    #  #  #     #  #    #      #      #  #   #   # #    #   #  # #  #   #     #    #
    #  # #       # #    #      #      ###  ##### #  #   #   #  # ###   #       #   #   #
    

    Alex

    Posted 2014-10-13T11:15:15.893

    Reputation: 417

    This is not a serious contender. – Esolanging Fruit – 2017-06-04T06:54:46.397

    3@Challenger5 Yes, "However, I'm also rewarding other witty submissions with up-votes (and I encourage everybody to do so as well). Therefore although this is a code-golf contest, not-so-short answers are also welcome." – Alex – 2017-06-04T18:09:50.953

    7

    PowerShell - 69 64 59

    1,1,0,1|%{"Happy Birthday "+("Dear $ShellId","To You")[$_]}
    

    and 91

    $a,$b,$c="Happy Birthday.To You.Dear PowerShell".Split(".");1..2|%{"$a $b"};"$a $c";"$a $b"
    

    and 108

    $a=@();$b,$c="To You.Dear PowerShell".Split(".");1..4|%{$a+="Happy Birthday $b"};$a[2]=$a[2]-replace$b,$c;$a
    

    SomeShinyObject

    Posted 2014-10-13T11:15:15.893

    Reputation: 953

    6

    Ruby, 56

    x="Happy Birthday To You
    "*4
    x[59,6]="Dear Ruby"
    puts x
    

    britishtea

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 189

    1ockquote>

    Newlines in strings. Okay, now i'm completely convinced that ruby is just voodoo magic and as a peasant I should stick to python instead.

    – sagiksp – 2017-04-19T05:35:33.253

    Can't you inline things ? – Optimizer – 2014-10-13T14:04:30.753

    2A method ending in = always returns the result of the expression after the equals sign. If I inlined this, it'd only print "Dear Ruby" (String#[]= is a method). – britishtea – 2014-10-13T14:07:06.073

    6

    Marbelous, 151

    Prints Happy Birthday every time hb is called, with either to you or Dear Marbelous appended, based on whether the input is 0 or 1. The passed marble in hb will not be outputted, as it will get stuck in the synchroniser &0.

    03
    00
    02
    01
    hb
    :hb
    }0
    =0&0
    &1
    &2//
    746F20596F7544656172204D617262656C6F75730A
    &0&0&0&0&0&0&1&1&1&1&1&1&1&1&1&1&1&1&1&1&2
    486170707920426972746864617920
    

    Below is the board hb, with hex converted to ascii text: enter image description here

    es1024

    Posted 2014-10-13T11:15:15.893

    Reputation: 8 953

    5

    05AB1E, 36 bytes

    ”ŽØ¢©”©" to You"«Ð®" Dear 05AB1E"«s»
    

    TIO Nexus

    Try it online!

    Output:

    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday Dear 05AB1E
    Happy Birthday to You
    

    Explanation:

    ”ŽØ¢©”                                Push "Happy Birthday"
                                           STACK: ["Happy Birthday"]
          ©                               Store in register w/o popping
           " to You"«                     Append " to You"
                                           STACK: ["Happy Birthday to You"]
                     Ð                    Triplicate the string
                                           STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday to You"]
                      ®                   Push "Happy Birthday" from register
                                           STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday to You", "Happy Birthday"]
                       " Dear 05AB1E"«    Append " Dear 05AB1E"
                                           STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday to You", "Happy Birthday Dear 05AB1E"]
                                      s   Swap top two strings
                                           STACK: ["Happy Birthday to You", "Happy Birthday to You", "Happy Birthday Dear 05AB1E", "Happy Birthday to You"]
                                       »  Join by newlines
    

    acrolith

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 728

    5

    CJam, 46 bytes

    4,{"Happy Birthday "\2="Dear CJam""to You"?N}%
    

    Try it here.

    4,                                             "Push [0,1,2,3].";
      {                                         }% "Map...";
       "Happy Birthday "                           "Push the string.";
                        \                          "Swap top two stack elements (string and
                                                    array element)";
                         2=                        "Check equality with 2.";
                           "Dear CJam""to You"     "Push two more strings.";
                                              ?    "Select string based on result of 2=.";
                                               N   "Push a line break";
    

    This leaves the following array on the stack:

    ["Happy Birthday " "to You" "\n" "Happy Birthday " "to You" "\n" "Happy Birthday " "Dear CJam" "\n" "Happy Birthday " "to You" "\n"]
    

    Whose contents are automatically printed back-to-back at the end of the program.

    Alternatively, with a for-loop and the same character count:

    4{"Happy Birthday "I2="Dear CJam""to You"?N}fI
    

    Martin Ender

    Posted 2014-10-13T11:15:15.893

    Reputation: 184 808

    5Liar!! your favorite language is Ruby/Mathematica :P – Optimizer – 2014-10-13T11:41:13.057

    1@Optimizer Certainly not Ruby, maybe Mathematica, but I'm not even sure about that. For "real" programming I'd probably always choose C/C++/C#. (I'm also pretty sure, that yours is JS :P.) – Martin Ender – 2014-10-13T11:44:04.017

    5you got me :P :D – Optimizer – 2014-10-13T11:48:28.297

    5

    GolfScript: 54 characters

    4,{"Happy Birthday "["To You""Dear GolfScript"]@2==n}%
    

    Sample run:

    bash-4.3$ golfscript.rb <<< '4,{"Happy Birthday "["To You""Dear GolfScript"]@2==n}%'
    Happy Birthday To You
    Happy Birthday To You
    Happy Birthday Dear GolfScript
    Happy Birthday To You
    

    manatwork

    Posted 2014-10-13T11:15:15.893

    Reputation: 17 865

    I just noticed it. (Little side effect of trying to write that GolfScript code for about 5~6 hours.) Thanks, @MartinBüttner. – manatwork – 2014-10-13T17:08:44.630

    1Happy Birthday Dear CodeGolf? – Dennis – 2014-10-14T02:09:33.707

    Grr. I was tired not only when wrote it, but also when fixed it. Thanks @Dennis. – manatwork – 2014-10-14T08:06:27.233

    5

    Haskell: 75

    h="Happy Birthday "
    y=h++"to You"
    main=mapM_ print[y,y,h++"Dear Haskell",y]
    

    Code output in ideone

    Haskell one liner: 79

    mapM_ print["Happy Birthday "++if x==3then"Dear Haskell"else"to You"|x<-[1..4]]
    

    You can try the one liner online here: http://tryhaskell.org/

    user32020

    Posted 2014-10-13T11:15:15.893

    Reputation:

    1A one liner that shaves off one character: mapM_(print.("Happy Birthday "++))["to You","to You","dear Haskell","to You"] – Alex Reinking – 2014-10-18T02:42:52.917

    list comprehensions are soooo loooonnnnggggg – Alex Reinking – 2014-10-18T02:45:06.627

    2also, it should technically be putStrLn to conform to the spec (you get double quotes with print) – Alex Reinking – 2014-10-18T02:45:52.210

    2The _ is not needed because the return value of main is thrown away - you only see it in GHCi – proud haskeller – 2014-10-18T10:43:51.533

    5

    Var'aQ - 121

    "Happy Birthday " ~ a cher "to you\n" tlheghrar ~ b cher b tlheghrar a "dear Var'aQ" tlheghrar tlheghrar b tlheghrar cha'
    

    Beta Decay

    Posted 2014-10-13T11:15:15.893

    Reputation: 21 478

    1Qapla'!

    +1 for using Var'aQ of all languages! – WallyWest – 2014-10-15T04:37:43.197

    5

    T-SQL (MS compliant): 75

    print stuff(replicate('Happy Birthday to You '+char(10),4),62,6,'Dear SQL')
    

    Kyle Hale

    Posted 2014-10-13T11:15:15.893

    Reputation: 151

    Great idea! Save 9 more bytes by replacing +char(10) with a line break inside the quote, just make the return part of the string. – BradC – 2018-01-11T15:56:37.840

    Nice one ... wish I had thought of that:) – MickyT – 2014-10-20T23:46:31.667

    5

    C# (75) (73)

    Using System.Diagnostics for the purpose of Debug.Print

    Upgrade to @Abbas' code

    string x="\nHappy Birthday ",y=x+"to You";Debug.Print(y+y+x+"Dear C#"+y);
    

    Upgrade to @Tyress' code (83) (76)

    for(int i=0;i++<4;)Debug.Print("Happy Birthday "+(i!=3?"to You":"Dear C#"));
    

    Output:

    Happy Birthday To You
    Happy Birthday To You
    Happy Birthday Dear C#
    Happy Birthday To You
    

    Master Mick

    Posted 2014-10-13T11:15:15.893

    Reputation: 151

    2You can save a couple characters using String.Format and the ternary operator. You can also make this look much less like a C# program and use i++<3 ;p – FryAmTheEggman – 2014-10-15T16:35:14.430

    5

    Reng, 66 bytes

    Noncompeting.

    A"uoY ot yadhtriB yppaH"¤ao;A"gneR raeD yadhtriB yppaH ~"S0gO0gao;
    

    Simple enough. A is 10, or a newline. "uoY ot yadhtriB yppaH" pushes that string, ¤ duplicates the string, ao; outputs everything. The second part is more interesting. "A"gneR raeD yadhtriB yppaH ~" pushes that string. S pushes 28, and 0g sets the character at (0, 28) to the top of stack, or a ~, the end program signal. This sets the last A to a tilde. Then, O0g sets the character at(0, 24) to a space/nop, removing the duplicate stack command. We print the third line using ao;. Then, we wrap around to the beginning of the line and print the last line again.

    Here's a GIF, because who doesn't like those?

    GIIIIF

    Conor O'Brien

    Posted 2014-10-13T11:15:15.893

    Reputation: 36 228

    4

    Excel VBA, 687 686 686 681 Bytes

    From the problem statement:

    However, I'm also rewarding other witty submissions with up-votes (and I encourage everybody to do so as well). Therefore although this is a code-golf contest, not-so-short answers are also welcome.

    Code

    Full subroutine that takes no input and outputs a happy birthday song for VBA onto the range [A1:CM23] of the ActiveSheet object.

    Global l
    Sub a
    Cells.RowHeight=48
    For l=0To 3
    p[A1:A5,B3,C1:C5,F1,E2:E5,G2:G5,F3,I1:I5,J1,K2,J3,M1:M5,N1,O2,N3,Q1:Q2,R3:R5,S1:S2]
    p[Y1:Y5,Z1,AA2,Z3,AA4,Z5,AC1:AE1,AD2:AD4,AC5:AE5,AG1:AG5,AH1,AI2,AH3,AI4:AI5,AK1:AM1,AL2:Al5,AO1:AO5,AP3,AQ1:AQ5,AS1:AS5,AT1,AU2:AU4,AT5,AX1,AW2:AW5,AY2:AY5,AX3,BA1:BA2,BB3:BB5,BC1:BC2]
    If l-2Then p[BI1:BK1,BJ2:BJ5,BN1,BM2:BM4,BN5,BO2:BO4,BU1:BU2,BV3:BV5,BW1:BW2,BZ1,BY2:BY4,BZ5,CA2:CA4,CC1:CC4,CD5,CE1:CE5]Else p[BI1:BI5,BJ1,BK2:BK4,BJ5,BM1:BM5,BN1:BO1,BN3,BN5:BO5,BR1,BQ2:BQ5,BS2:BS5,BR3,BU1:BU5,BV1,BW2,BV3,BW4:BW5,CC1:CC4,CD5,CE1:CE4,CG1:CG5,CH1,CI2,CH3,CI4,CH5,CL1,CK2:CK5,CM2:CM5,CL3]
    Next
    End Sub
    Sub p(r)
    r.Offset(6*l).Interior.Color=0
    End Sub
    

    Output

    enter image description here

    Taylor Scott

    Posted 2014-10-13T11:15:15.893

    Reputation: 6 709

    1This is a nice answer, +1 – caird coinheringaahing – 2017-09-23T20:32:22.353

    4

    Java, 127 125 bytes

    class h{public static void main(String[]a){String b="\nHappy Birthday ",d=b+"to You";System.out.print(d+d+b+"Dear Java"+d);}}
    

    However, if you ignore all of the excess stuff, it is only 82 80 bytes:

    String b="\nHappy Birthday ",d=b+"to You";System.out.print(d+d+b+"Dear Java"+d);
    

    Oh, and it starts with a newline, saving 2 bytes.

    Stretch Maniac

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 971

    1output is not exactly as required, since there's an extra line at the start – Supuhstar – 2014-10-17T01:13:37.777

    3@Supuhstar It merely says to output the song happy birthday. It makes no requirement for excess newlines/whitespace. – Stretch Maniac – 2014-10-17T02:56:18.647

    it says "writes the following text to the standard output or an arbitrary file:"... so... maybe you could stretch that to include extra bits? It doesn't sound like this is the intended answer, though. – Supuhstar – 2014-10-17T03:02:39.520

    I'm not exactly sure what you mean, but System.out.println is a standard output. – Stretch Maniac – 2014-10-17T03:04:31.397

    I don't mean the output method, but the actual output, which starts with a blank line – Supuhstar – 2014-10-17T03:14:30.540

    4

    BBC BASIC, 81 / 76 ASCII characters

    Download interpreter at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html

    Unfortunately, it's not possible to choose between strings within an expression, so the line endings are repetitively encoded in a DATA statement. On the other hand, when you read the last line, it does sound quite musical.

    FORk=1TO4READa$PRINT"Happy Birthday ";a$:NEXT 
    DATAto You,to You,Dear BASIC,to You
    

    We can, however, choose what substring to select from a given string, for a saving of 5 characters (note that k=3 evaluates to -1 when true):

    FORk=1TO4PRINT"Happy Birthday ";MID$("Dear BASICto You",11+(k=3)*10,10):NEXT
    

    BBC BASIC, 69 ASCII characters

    A shorter way:

    a$="Happy Birthday "b$="to You"PRINTa$;b$'a$;b$'a$;"dear BASIC"'a$;b$
    

    Level River St

    Posted 2014-10-13T11:15:15.893

    Reputation: 22 049

    I had no idea that you didn't need a colon for one-liners... – Beta Decay – 2014-10-15T18:14:42.340

    1@BetaDecay according to the official syntax you do need the colon in most cases. But in practice BBC BASIC for Windows lets you get away without them. The original BBC Micro manual gave certain advice for improving the speed of your programs, of which I've taken in the following: use lowercase variable names, and eliminate as many unnecesary characters as possible. – Level River St – 2014-10-15T18:32:30.940

    4

    Groovy (64)

    4.times{println"Happy Birthday ${it==2?'Dear Groovy':'to You'}"}
    

    Will Lp

    Posted 2014-10-13T11:15:15.893

    Reputation: 797

    4

    Common Lisp (62 60 chars)

    (format t"~@{Happy Birthday ~[to You~;dear CL~]~%~}"0 0 1 0)
    

    Output

    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday dear CL
    Happy Birthday to You
    

    coredump

    Posted 2014-10-13T11:15:15.893

    Reputation: 6 292

    Is the space before and after the string needed? – kay - SE is evil – 2014-10-21T01:40:33.387

    @Kay No, the space is not needed. I removed it, which saves 2 chars. Thanks. – coredump – 2014-10-21T05:58:07.377

    4

    VBA 99

    Why VBA? Why not?

    Sub H(): For i = 0 To 3: MsgBox "Happy Birthday " & IIf(i = 2, "Dear VBA", "to You"): Next: End Sub
    

    Ungolfed

    Sub H()
        For i = 0 To 3
            MsgBox "Happy Birthday " & IIf(i = 2, "Dear VBA", "to You")
        Next
    End Sub
    

    RubberDuck

    Posted 2014-10-13T11:15:15.893

    Reputation: 321

    For what it's worth (2.5yrs later), you can remove the auto-formatting to get it down to 86 bytes: Sub H():For i=0To 3:MsgBox"Happy Birthday " &IIf(i=2,"Dear VBA","to You"):Next:End Sub – Engineer Toast – 2017-04-27T13:03:07.897

    @EngineerToast I don't feel like that's legit. The only environment that compiles that code enforces those spaces. – RubberDuck – 2017-04-27T13:31:01.337

    1

    I used to think that, too, so I did some searching on meta and found a post that made sense to me saying why autoformatting should be discounted. It's not wrong either way but I somewhat enjoy finding all the white space I can remove from VBA and have it still work.

    – Engineer Toast – 2017-04-27T14:02:34.380

    @EngineerToast I'll actually buy that, because the official grammar doesn't require the white space. – RubberDuck – 2017-04-27T14:05:41.570

    2Still shorter than C# :D – Brandon – 2014-10-17T12:22:25.340

    4

    Casio CFX-9850G, 121 bytes 96

    Just for the fun of it, the Happy Birthday song for the CFX-9850G graphing calculator.

    Some instructions are just displayed as multiple bytes, but as far as I know they are encoded as 1 or 2 bytes. I marked them with colors. Edit: I checked the memory, so the program uses 121 bytes in the calculator.

    The song text would not fit in a line, especially line 3 because in text mode the calculator can only display 7 rows and 21 columns. So I print the lyrics in graphing mode, which uses a tiny font.

    Happy Birthday, CFX-9850G. Program

    Here is the output:

    Happy Birthday CFX-9850G. Output

    M L

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 865

    4

    Qt 5.4 qmake pro file, 119 bytes

    Since the winner has already been announced, I thought I'd give a try for the witty category.

    O=$$escape_expand(\n)
    A=Happy Birthday
    B=$$A to you$$O
    CONFIG(debug,debug|release){log($$A dear qmake$$O)}log($$B)
    

    This abuses qmake horribly.

    qmake under default settings will parse a script 3 times over. For debug, release, and a build_pass. So we just let it throw out the "Happy Birthday" for all logs, with an extra "To you..." when a debug makefile is being generated.

    Happy Birthday to you
    Happy Birthday to you
    Happy Birthday dear qmake
    Happy Birthday to you
    

    ForemanBob

    Posted 2014-10-13T11:15:15.893

    Reputation: 61

    4

    Retina, 47 49 50 52 bytes

    The program is encoded as ISO-8559-1 (which the official interpreter accepts). The leading newline is significant.

    
    ¶¶x¶
    
    Happy Birthday to You
    .{27}u
    Dear Retina

    Try it online.

    Explanation

    Step 1: Replace the (empty) input with “newline, newline, x, newline”.

    Step 2: In between every character, insert Happy Birthday to You. We now have:

    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday to YouxHappy Birthday to You
    Happy Birthday to You
    

    Step 3: replace a 28-character string ending in u and not containing a newline with Dear Retina. The only occurrence of that is to YouxHappy Birthday to You.

    Timwi

    Posted 2014-10-13T11:15:15.893

    Reputation: 12 158

    3

    Underload, 59 Bytes

    (to You
    ):(Happy Birthday ):S~S:S~:S~:S(Dear Underload
    )SSS
    

    I was hindered by Underload's lack of stack manipulation commands. I had to push stuff in a strange order and swap a bit more than I would have preferred, but oh well...

    Stack trace:

    (...) | (to You)
    :     | (to You)(to You)
    (...) | (to You)(to You)(Happy Birthday )
    :S    | (to You)(to You)(Happy Birthday )         ; output "Happy Birthday "
    ~     | (to You)(Happy Birthday )(to You)
    S     | (to You)(Happy Birthday )                 ; output "to You"
    :S    | (to You)(Happy Birthday )                 ; output "Happy Birthday "
    ~     | (Happy Birthday )(to You)
    :S    | (Happy Birthday )(to You)                 ; output "to You"
    ~     | (to You)(Happy Birthday )
    :S    | (to You)(Happy Birthday )                 ; output "Happy Birthday "
    (...) | (to You)(Happy Birthday )(Dear Underload)
    S     | (to You)(Happy Birthday )                 ; output "Dear Underload"
    S     | (to You)                                  ; output "Happy Birthday "
    S     |                                           ; output "to You
    

    Esolanging Fruit

    Posted 2014-10-13T11:15:15.893

    Reputation: 13 542

    3

    C++, 135 bytes

    Great thanks to Steadybox and DJMcMayhem for shortening this code by 55 characters! :)

    #include<iostream>
    #include<string>
    std::string s="Happy Birthday ",t="to you\n",u="Dear C++\n";int main(){std::cout<<s+t+s+t+s+u+s+t;}
    

    Colin Robertson

    Posted 2014-10-13T11:15:15.893

    Reputation: 31

    1You can use + instead of <<. – James – 2018-01-11T17:58:27.813

    1

    Welcome to PPCG! You can remove the space from between #include and <headerName>. Also, you can declare the strings in one go so you don't have to repeat the string. (After that using the std:: prefix is shorter than using namespace std;, too). Like this.

    – Steadybox – 2018-01-11T18:11:12.763

    3

    JavaScript, 74 73

    for(i=5;--i;)console.log('Happy birthday',i-2?'to you':'dear JavaScript')
    

    Thanks to Dancrumb for the byte-saving tip. It would be 68 67 bytes if I could use 4 alerts instead of newlines.

    for(i=5;--i;)alert('Happy birthday',i-2?'to you':'dear JavaScript')
    

    NinjaBearMonkey

    Posted 2014-10-13T11:15:15.893

    Reputation: 9 925

    1You can shave off a byte with: for(i=5;--i;)console.log('Happy birthday',i-2?'to you':'dear JavaScript') – Dancrumb – 2014-10-13T16:15:37.970

    1

    If you want alert(), then use only 1, based on my comment at the other JavaScript answer. That will be 71 character without alert() flood.

    – manatwork – 2014-10-13T16:26:56.753

    You could also avoid the loops and let the output just be the expression itself (which is true on newer consoles): (a="\nHappy Birthday")&&(b=a+" to You")&&b+b+a+" Dear JavaScript"+a (67 too). – AmadeusDrZaius – 2014-10-18T19:19:28.433

    3

    Brainfuck, 593 characters

    Used this

    ++++++++++[>+>+++>++++++>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++<<<<<<<<<-]>>>>++.>>+++++++.>>++..>+.<<<<<<<++.>++++++.>>>>+++++.>++.++.<-.----.<.>>>.<<<<<<<.>>>>>>.-----.<<<<<<.>>>+++++++++.>>>.++++++.<<<<<<<.>>>.>>.>>-----..>.<<<<<<<.>.>>>>+++++.>++.++.<-.----.<.>>>.<<<<<<<.>>>>>>.-----.<<<<<<.>>>.>>>.++++++.<<<<<<<.>>>.>>.>>-----..>.<<<<<<<.>.>>>>+++++.>++.++.<-.----.<.>>>.<<<<<<<.>++.>>>>+.<.>>--.<<<<<<.>--.>>>>>.<<.>++++.>----.<---.>+++++++.<<++.>+++++.<<<<<<.>>>.>>--.>>-----..>.<<<<<<<.>.>>>>--.>++.++.<-.----.<.>>>.<<<<<<<.>>>>>>.-----.<<<<<<.>>>.>>>.++++++.
    

    Varun Appaswami

    Posted 2014-10-13T11:15:15.893

    Reputation: 31

    3

    Powershell one liner: 73 71

    1..4|%{"Happy Birthday $(if($_-eq3){"Dear Powershell"}else{"to You"})"}

    Dave Neeley

    Posted 2014-10-13T11:15:15.893

    Reputation: 131

    1You could shrink this to 71 if you did $_-eq3 – SomeShinyObject – 2014-10-16T13:06:14.967

    3

    J (44)

    2|.'Happy birthday ',"1'dear J',>3#<'to you'
    

    marinus

    Posted 2014-10-13T11:15:15.893

    Reputation: 30 224

    3

    Swift, 83

    Run this in Xcode Playground

    let h="\nhappy birthday"
    let t=" to you"
    let f=h+t+h+t+h+" dear Swift"+h+t
    print(f)
    

    dKrawczyk

    Posted 2014-10-13T11:15:15.893

    Reputation: 31

    If you put the space after happy birthday, you can get rid of the two in to you and dear Swift, saving you one byte – Beta Decay – 2014-10-15T06:11:40.147

    If you declare all 3 variables on the same line, you can save 8 bytes. – NobodyNada - Reinstate Monica – 2014-10-18T20:56:41.823

    3

    Lua, 96 bytes

    I was trying to be cool about this and make use of all the best Lua tricks I know but the guy who wrote a simple for loop with an if i==3 beat me by 20+ bytes >.<

    Still, I think this is pretty cool in terms of Golfing:

    a='Happy Birthday to you\ndear Lua\n'print(a:sub(0,-10):rep(3):sub(0,-8)..a:rep(2):sub(23,-10))
    

    I was looking at recursively building the string a from a number using string.char() but I couldn't compress it anywhere near the length of a='Happy Birthday to you\ndear Lua\n'

    Peabnuts123

    Posted 2014-10-13T11:15:15.893

    Reputation: 31

    3

    APL: 45

    4 23⍴'Dear APL',⍨61⍴'Happy birthday to you  '
    

    Explanation:

    61⍴ reapeats the string up to length 61, after which "Dear APL" is concatenated (,)

    Note that ⍨ inverts arguments, so it's added at the end.

    4 23⍴ just makes a matrix 4x23 using the string on the right, starting from the beginning of the string each time it reaches the end.

    Moris Zucca

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 519

    3

    Pyth, 42

    V4+"Happy Birthday "?"to You"nN2"Dear Pyth
    

    Demonstration:

    $ pyth -c 'V4+"Happy Birthday "?"to You"nN2"Dear Pyth'
    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday Dear Pyth
    Happy Birthday to You
    

    How it works:

    V4 sets up a for loop, with N iterating over 0, 1, 2, 3.

    Then, we create the string starting with "Happy Birthday ", and ending with "to You" if N does not equal 2 (nN2 calculates this), or ending with "Dear Pyth" otherwise.

    Exact tie with CJam - language name and character count.


    Alternative, 43 character solution:

    J"Happy Birthday to You"JJ+<J15"Dear Pyth"J
    

    It's one character longer because it needs an end quote.

    isaacg

    Posted 2014-10-13T11:15:15.893

    Reputation: 39 268

    Aren't the V and N implemented after the question was asked ? – Optimizer – 2014-10-21T19:38:48.597

    1@Optimizer No, they were added a while ago. Looking back at the commit log, they were added on August 21st, in a commit called: Pyth 2.1.0 - Changes to -;\AcPUVXz Out of curiosity, what gave you that impression? – isaacg – 2014-10-21T19:50:46.130

    Your recent Pyth tips answer left me thinking that it is something new and u always keep saying that you keep on adding features :). – Optimizer – 2014-10-21T19:56:43.780

    @Optimizer Ah - while I do add new things, I'm also trying to give general programming tips on that page, which cover everything in Pyth. – isaacg – 2014-10-21T20:21:52.553

    3

    Julia, 75 67 65 characters

    a,b,c="Happy Birthday ","To You\n","Dear Julia\n";print("$a$b$a$b$a$c$a$b")

    a="Happy Birthday";b=("$a To You\n");print("$b$b$a Dear Julia\n$b")

    a="Happy Birthday To You\n";print("$a$a$(a[1:15])Dear Julia\n$a")

    Just for fun, here is an ungolfed version, with a loop (114 characters):

    for i = 1:4
        a,b,c = "Happy Birthday ","To You","Dear Julia"
        i != 3 ? println("$a$b") : println("$a$c")
    end
    

    M L

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 865

    3

    Bubblegum, 42 bytes

    0000000: f3 48 2c 28 a8 54 70 ca 2c 2a c9 48 49 ac  .H,(.Tp.,*.HI.
    000000e: 54 28 c9 57 88 cc 2f e5 22 4a d4 25 35 b1  T(.W../."J.%5.
    000001c: 48 c1 a9 34 29 29 27 35 bd 34 17 bb 1e 00  H..4))'5.4....
    

    Note that this answer is non-competing, since Bubblegum is a lot younger than this challenge.

    Dennis

    Posted 2014-10-13T11:15:15.893

    Reputation: 196 637

    3

    Fishing, 116 bytes

    v+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      `Happy Birthday `P{`to You`N}P{N}P{{`Dear Fishing`N}}P{N
    

    Arcturus

    Posted 2014-10-13T11:15:15.893

    Reputation: 6 537

    I've posted a few questions, but here's my first answer! – Arcturus – 2015-10-09T23:25:05.637

    3

    Seriously, 59 57 bytes (non-competitive)

    "Happy Birthday to You";"Happy Birthday Dear Seriously"@;

    Explanation

    Push "Happy Birthday to You", duplicate, push "Happy Birthday Dear Seriously", rotate the two top elements, duplicate, and implicit popping and printing.

    TanMath

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 431

    57 bytes: "Happy Birthday to You";"Happy Birthday Dear Seriously"@; – Mego – 2016-01-08T04:24:37.503

    3

    ///, 48 bytes

    /U/Happy Birthday //T/Uto You/T
    T
    UDear \/\/\/
    T
    

    Erik the Outgolfer

    Posted 2014-10-13T11:15:15.893

    Reputation: 38 134

    2

    Vim, 40 36 bytes

    4OHappy Birthday to You<esc>k2bCDear Vim
    

    4 bytes saved thanks to @DJMcMayhem by using O instead of i...\n and k2bC instead of kd2bC

    This uses a completely different approach to the previous Vim answer and hence I posted it as a separate answer. Outputs a trailing newline, but can be removed at the cost of one extra byte by using Jk instead of k.

    Since V is reverse compatible with V, you can Try it online!

    Take that CJam!

    user41805

    Posted 2014-10-13T11:15:15.893

    Reputation: 16 320

    This is the shortest competing solution, as far as I can tell. – primo – 2018-03-12T14:15:36.127

    2

    Japt, 41 38 bytes

    `Happy Bir»y  Y
    `
    ³h58Ui` De Japt
    

    Test it

    Oliver

    Posted 2014-10-13T11:15:15.893

    Reputation: 7 160

    2

    IDL (Interactive Data Language) – 47

    Late entry (my first time here), but this looks like 3rd place after CJam and J!

    Using IDL's Implied Print feature (since version 8.3), typing this at the command prompt:

    'Happy Birthday '+[(u='to You'),u,'Dear IDL',u]
    

    … will print the desired result to the console:

    IDL> 'Happy Birthday '+[(u='to You'),u,'Dear IDL',u]
    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday Dear IDL
    Happy Birthday to You
    

    It works by creating (and implicitly printing) a four-element array, with 'Happy Birthday ' appended to each of the four desired endings, made more concise/cryptic by assigning a variable u the value 'to You' in the first instance, and reusing it twice later!

    Dick Jackson

    Posted 2014-10-13T11:15:15.893

    Reputation: 21

    2

    Brachylog, 52 bytes

    "Happy Birthday to You"k₆,"Dear Brachylog"g,?,?↺,?ẉᵐ
    

    Try it online!

    -1 thanks to Fatalize.

    Erik the Outgolfer

    Posted 2014-10-13T11:15:15.893

    Reputation: 38 134

    You can do 52 bytes by replacing Z with ? and removing the first Z that unifies with the string. – Fatalize – 2017-08-02T14:29:58.300

    @Fatalize Oh right the string unifies with ?. – Erik the Outgolfer – 2017-08-02T17:47:31.533

    2

    Unary, 2.715E2345 bytes

    A string of zeroes with a length of 271544303753521374345784023617462447448766796991634195623271771343788064494033932467809637777433783261069835136468316635541569006957484008922172956907493623220358279584621153727394685316177875072717611870164011317998138133192412590581118711745080372132354520144049887264020357596958970682508119612069072184789433001139110110044141818883356102010044766108874743534376722033752443907309500308124800880956659496453762860029730933467190897780852535562502370486347488149358821225254933647032473098015846900520720300239993510123716590092279978630211422199772105659685365124211730629429856761187973769267382198582572968422104301126603859498501185917608874757741610893482041977003001381483481251619529628722427408338582339527157335234122942381275923949390605570564504822082772136057434464671123507495503027121245882553216512907124492451345153924551954324886539679044057026572440371334484657248811556813671966134409423451672608237773610848374597757496223902091127753821502096156978576733667670645804932685651998882744625271805968408192138003017383834286411465787825657955474390895833048578431020834761999769245058175985114327604667460675218915598066545717356728963407131382225834981689192053204022543453105950548359569307644293248265610511261123308873236361708287888512920927207140733264710153499926338085521461180344119631268486929440101264937117199882754841067458895376078972797675755102211602033168204711199744629239139853151734765325982327999734282103666604630769384354544377780974557091020653916122475973344426958326542939871981389127350485205414017350058299535652163085166091203298279054857159449355550278205308529995426116266317622349698148579685752377806473014344962213328458584663395562552762790574493037199848761427965675120816268240569132735553272845975553355819867289784427736974879735152861965319683108949477353673024614920892135291073944764379263817004591234093204928220689300382675729272978243082941205866127086587758323575891345926945843642967213885479373059430434109978135813970824413339027287055293233734939242557385167820253321966087885920624040254325137166864535273452145628538868866835395916784107310616214635120965693431403440614294637759561044455445706647271846433473546725069631283599186867863795122114084809385455487348989575611753135663244291563170055464760084089978670081473032469603515349502029160880861825869931824089974215244

    Husnain Raza

    Posted 2014-10-13T11:15:15.893

    Reputation: 329

    1I thought this was a good score till I saw the "E" – NoOneIsHere – 2017-09-23T20:45:33.967

    2

    Aceto, 57+1 for -l flag = 58 bytes

    "Happy Birthday "ddd"to you"ddQJpnQJpn"Dear Aceto"QJpnsJp
    

    Try it online!

    "Happy Birthday "                           push that string
                     ddd                        duplicate three times
                        "to you"                   push that string
                                dd                    duplicate twice
                                  Q                    Pull from bottom of stack
                                   Jpn                 Join, print, & newline
                                      QJpn               pull from bottom, &Join,print&\n
                                          "Dear Aceto"        push that string
                                                      QJpn      Pull,Join,print,\n
                                                          sJp     swap, Join, and print

    drham

    Posted 2014-10-13T11:15:15.893

    Reputation: 515

    2

    Stax, 30 bytes

    ï■σ∞úφ♂mê▌δ↓T┌C▒7w↓√éº┌│╦╫C∩█ï
    

    Run and debug online!

    Explanation

    Uses ASCII representation to explain:

    `=%5#`GG`!0 ZrO"`GdG}`I#aq5J^oD}(`pQ
    
                        }                   Define a subroutine after the bracket
                         `I#aq5J^oD}(`      Push "Happy Birthday "
                                      p     Pop the string and print without newline
                                       Q    Peek the stack and print with newline
    
    `=%5#`                                  Push "to You"
          GG                                Call the subroutine twice
            `!0 ZrO"`                       Push "Dear Stax"
                     G                      Call the subroutine
                      d                     Pop and discard "Dear Stax"
                       G                    Call the subroutine again
    

    Weijun Zhou

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 396

    I like your favorite language. Here's 28 for the lead.

    – recursive – 2018-03-16T21:12:03.137

    2

    R, 56 bytes

    cat("",u<-"to You
    ",u,"Dear R
    ",u,sep="Happy Birthday ")
    

    Try it online!

    The old sep= trick.

    JayCe

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 655

    2

    Rust, 98 bytes

    fn main(){for i in range(0i,4){println!("Happy birthday {}",match i{2=>"dear Rust",_=>"to you"})}}
    

    Fox Wilson

    Posted 2014-10-13T11:15:15.893

    Reputation: 318

    Suggest 0..4 instead of range(0i,4) – ceilingcat – 2017-11-08T22:13:06.290

    @ceilingcat: And swap match for if...else, use print!,neglect fn main: 78 bytes https://tio.run/##KyotLvmflqeQm5iZp6FZ/T8tv0ghUyEzT8FAT8@kuqAoM69EUUPJI7GgoFIhKbOoJCMlsVKhupZLSSczTSHT1taoWiklNbFIIQhojlJtak5xarVSSb5CZX6pUq1m7X9rrloqGwkA

    – Phil H – 2019-09-04T10:28:25.637

    2

    Lua: 91 72 characters

    First pass:

    for i=1,4 do io.write'Happy Birthday 'if i==3 then print'Dear Lua'else print'to You'end end
    

    Demo

    Even smaller:

    for i=1,4 do print('Happy Birthday '..(i==3 and'Dear Lua'or'to You'))end
    

    Demo

    TI-BASIC: 65

    :PROGRAM:H
    :"HAPPY BIRTHDAY TO YOU
    :Disp Ans,Ans,sub(Ans,1,15)+"DEAR TI-BASIC
    :Disp Ans
    

    In TI-BASIC, all built-in commands (even multi letter ones) are either one or two bytes on the calculator. The size I used represents the (minimum, since names take space) space taken by this code on my TI-84+SE running OS version 2.53MP. Seemingly wrong syntax (unclosed strings) is intentional.

    TI-68k: 90

    :h()
    :Prgm
    :"Happy Birthday to You"→a
    :Disp a,a,mid(a,1,15)&"Dear TI-68k",a
    :EndPrgm
    

    Again, the size I used is the minimum real size on the calc (in this case, a TI-92).

    skwerlman

    Posted 2014-10-13T11:15:15.893

    Reputation: 21

    2

    R, 69 chars

    for(i in 1:4)cat('Happy Birthday',ifelse(i==3,'Dear R','to You'),'\n')
    

    Or

    for(i in 1:4)cat('Happy Birthday',if(i==3)'Dear R' else 'to You','\n')
    

    All output:

    Happy Birthday to You 
    Happy Birthday to You 
    Happy Birthday Dear R 
    Happy Birthday to You 
    

    Otherwise with 66 characters there was, without the for loop:

    a=rep('to You',4);a[3]='Dear R';cat(paste('Happy Birthday',a,'\n'))
    

    But it outputs:

    Happy Birthday to You 
     Happy Birthday to You 
     Happy Birthday Dear R 
     Happy Birthday to You 
    

    plannapus

    Posted 2014-10-13T11:15:15.893

    Reputation: 8 610

    2

    C#

    LINQPad (69):

    string x="\nHappy Birthday ",y=x+"to You";(y+y+x+"Dear C#"+y).Dump();
    

    Console (75):

    string x="\nHappy Birthday ",y=x+"to You";Console.Write(y+y+x+"Dear C#"+y);
    

    Ungolfed:

    string x = "\nHappy Birthday ";
    string y = x + "to You";
    
    //LINQPad
    (y + y + x + "Dear C#" + y).Dump(); 
    
    //Console
    Console.Write(y+y+x+"Dear C#"+y);
    

    Abbas

    Posted 2014-10-13T11:15:15.893

    Reputation: 349

    2

    PHP 67 63 62

    echo$z=($s="Happy Birthday").$t=" to You
    ","$z$s Dear PHP
    $z";
    

    EDIT: As @manatwork pointed out, without the second echo I have 4 chars less!!

    EDIT2: Other improvement according to @manatwork

    Alessandro

    Posted 2014-10-13T11:15:15.893

    Reputation: 121

    Nice one. But you not need a separate echo to have the earlier set variables available. Make the 2nd line: ","$z${s}Dear PHP. – manatwork – 2014-10-14T12:30:34.763

    @manatwork great suggestion! – Alessandro – 2014-10-14T12:34:54.947

    You can spare 1 more character by getting rid of those braces around variable ${s}. If you add the middle space to the both second half lines instead of the first half line, the length increases by 1 character, but you will be able to remove the braces, sparing 2 characters: http://pastebin.com/Qw7dWHGs

    – manatwork – 2014-10-14T12:35:06.867

    @manatwork I didn't got this... If I add the middle space to both the second half lines (before "to You" and before "Dear PHP") then I'm adding 2 chars and removing the brackets I have the same count – Alessandro – 2014-10-14T12:39:34.747

    Now: "Happy_" + "You" + "Dear", proposed : "Happy" + "_You" + "_Dear". So actually one of them you move and add just one new. – manatwork – 2014-10-14T12:44:16.503

    @manatwork genius! – Alessandro – 2014-10-14T12:52:39.957

    2

    Visual FoxPro - 77

    Not really my favorite language, but makes golfing somewhat interesting. Here is my greetings to it:

    a="Happy Birthday "
    b="to You"
    ?a+b
    ?a+b
    ?a+"Dear "+_screen.Caption
    ?a+b
    

    This abuses the fact that _screen.Caption (the main window title) initially contains Microsoft Visual FoxPro, handy here. If I'm allowed to call the language by its "friendly name", I can just replace that for "Fox" and save 10 characters.

    Alejandro

    Posted 2014-10-13T11:15:15.893

    Reputation: 161

    2

    PowerShell 62

    0..3|%{"Happy Birthday "+("to You","Dear PowerShell")[$_-eq2]}
    

    DarkAjax

    Posted 2014-10-13T11:15:15.893

    Reputation: 669

    2

    Vim, 90 45 bytes

    i
    Happy Birthday to you
    [ESC]
    yypppPWWd$adear Vim
    

    90 chars version:

    i
    Happy Birthday to you dear Vim
    [ESC]
    :%s/\(.* .* \)(.. .*\) \(.* .*\)/\1\2\r\1\2\r\1\3\r\1\2
    

    I'm certain there is a quicker way but this is what I just came up with :)

    Puts out

    Happy Birthday to you
    Happy Birthday to you
    Happy Birthday dear Vim
    Happy Birthday to you
    

    Angelo Fuchs

    Posted 2014-10-13T11:15:15.893

    Reputation: 295

    2

    Delphi, 154 146 139

    uses{$APPTYPE CONSOLE}SysUtils,StrUtils;var i:byte;begin
    for i:=0to 3do WriteLn('Happy birthday '+IfThen(i=2,'dear Delphi','to you'))end.
    

    R-D

    Posted 2014-10-13T11:15:15.893

    Reputation: 231

    Which Delphi version is this? I never met one with such Output parameter. And better choose another integer type, with a shorter name. For example Byte. – manatwork – 2014-10-16T15:17:33.247

    An insignificant bug: the 'to you' and 'dear Delphi' should be reversed. – manatwork – 2014-10-16T15:27:58.227

    1Some minor shortening which work in FreePascal: move the directive between uses and the first unit name to be able to remove the space (1 char); remove unnecessary newline characters (3 chars); remove the ; before end (1 char); remove the space characters between numeric literals and the following keywords (2 chars). See whether any of those works in your Delphi too. – manatwork – 2014-10-16T15:34:38.970

    @manatwork, thank you for your suggestions, it's Delphi XE2. – R-D – 2014-10-17T07:19:41.883

    1There's no need for Output,. – TLama – 2014-10-20T23:08:17.813

    2

    C (74 characters)

    main(i){for(i=4;i;)printf("Happy birthday %s\n",i---2?"to You":"Dear C");}
    

    Python 2 (72 characters)

    for k in range(4):print"Happy birthday",k==2 and"Dear Python"or"to You"
    

    Python 3 would need parentheses around the printed string, so two character more, so 74.

    PHP (66 characters)

    for($i=4;$i;)echo"Happy birthday ".($i---2?"to You\n":"Dear PHP\n");
    

    Stefano Sanfilippo

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 059

    In C, i---2 saves a character. Also {} after for isn't needed. – ugoren – 2014-10-20T09:32:10.927

    2

    TeX - 70

    \def\h{Happy Birthday }\def\y{to You}\h\y
    
    \h\y
    
    \h Dear TeX
    
    \h\y\bye
    

    Note that the line breaks are intentional and actually required.

    nyuszika7h

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 624

    2

    LaTeX, 182

    This isn't intended to be a serious competitive entry, but just to do something fun. Therefore, disregard the char count. I don't need any golfing tips for this, because it is intentionally ungolfed.

    \documentclass{article}
    \newcommand{\h}[1]{Happy Birthday to {#1}}
    \newcommand{\g}{\h{You}}
    \begin{document}
    \begin{verse}
    \g \\
    \g \\
    \h{\LaTeX} \\
    \g \\
    \end{verse}
    \end{document}
    

    archaephyrryx

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 035

    2

    Cardinal, 113 107 88 82 characters

    I fixed the errors in the original interpreter, so the operators work as specified. This enabled me to shrink down the code by another 19 25 characters:

    4th version:

    v8888#;++"lanidraC raeD " <
    8%+++>>"Happy Birthday"-jv^
    >8888@^        ;"uoY oT "<
    

    Output, using my interpreter fixes:

    Executing program..
    
    Happy Birthday To You
    Happy Birthday To You
    Happy Birthday Dear Cardinal
    Happy Birthday To You
    
    Execution complete.
    >
    

    Second version, saving 6 chars: I changed the o’s and O’s to v^<> because the available interpreter has some errors with the handling of the rotation operators o and O, j and J and some other errors. One has to use the wrong rotation operators to make it work, but I prefer using a version that works according to specification. The length of the code stays the same. This version works properly with the interpreter provided at the link given at the bottom of my comment: (107 characters)

    %->"Happy Birthd"v
    x ^D+;"uoY oT ya"<
       >"Happy Birthday D"v
    v"ppaH";"lanidraC rae"<
    >"y Birthday To You"@
    

    Output, using the "original" faulty interpreter:

    Executing program..
    
    Happy Birthday To You
    Happy Birthday To You
    Happy Birthday Dear Cardinal
    Happy Birthday To You
    
    Execution complete.
    >
    

    You can test the program if you save it as txt file and drag it onto the interpreter exe for Windows.

    http://esolangs.org/wiki/Cardinal

    Here is the interpreter: http://floatation.webs.com/Cardinal.zip

    M L

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 865

    2

    CMD - 84 Bytes

    cmd/v/c"set 1=to You&set 2=Dear CMD&for %a in (1,1,2,1)do @echo Happy Birthday !%a!"
    

    unclemeat

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 302

    2

    jq: 54 52 characters

    (49 characters code + 3 characters command line option.)

    0,0,1,0|"Happy Birthday "+["to You","Dear jq"][.]
    

    Sample run:

    bash-4.3$ jq -n -r '0,0,1,0|"Happy Birthday "+["to You","Dear jq"][.]'
    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday Dear jq
    Happy Birthday to You
    

    On-line test (Passing -r through URL is not supported – check Raw Output yourself.)

    manatwork

    Posted 2014-10-13T11:15:15.893

    Reputation: 17 865

    2

    Crayon, 48 46 bytes (non-competing)

    "Happy Birthday to You
    "4*q2Y15X"Dear¤Crayon"q
    

    Try it online! Non-competing because Crayon is much newer than this challenge.

    Explanation

    Crayon's output is built on a 2-dimensional "canvas", which makes it ideal for ASCII art challenges. Text is drawn with a "crayon", which is a sort of cursor that moves around the canvas. Here's how this program works:

    "Happy Birthday to You
    "                        Push this string to the stack.
     4*                      Repeat the string 4 times.
       q                     Draw the string at the crayon (at (0,0) by default).
        2Y15X                Move the crayon to the "to" in the third line.
             "Dear¤Crayon"q  Push this string and draw it at the crayon.
                             Implicit: Output canvas
    

    The ¤ represents byte \x1F; Crayon does not distinguish between the two. By default, a space does not overwrite the character underneath, so ¤ exists as a sort of "overwriting space".

    ETHproductions

    Posted 2014-10-13T11:15:15.893

    Reputation: 47 880

    1

    Jelly, 31 bytes (non-competing)

    “уẉ%VİỊ½żƒ»µ,;“©ʋ⁶ẓsŀKɗʠØ»,⁸¤Y
    

    Try it online!

    Erik the Outgolfer

    Posted 2014-10-13T11:15:15.893

    Reputation: 38 134

    1

    Pushy, 44 bytes

    Pushy doesn't actually have a string type. However, it has the command ", which interprets the current stack as a character list and prints it.

    `Happy Birthday `V`to You`""F`dear Pushy`"F"
    

    It's quite simple:

    `Happy Birthday `      % Push chars
    V                      % Copy into stack 2
    `to You`               % Push chars
    ""                     % Print stack 1 twice ("Happy Birthday to You")
    F                      % Go to stack 2
    `dear Pushy`           % Push chars
    "                      % Print stack ("Happy Birthday dear Pushy")
    F"                     % Print other stack again to complete the song.
    

    Basically, it uses the two stacks to construct the two needed strings, and prints them as it goes along. Here's the output:

    $ pushy happybday.pshy
    
    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday dear Pushy
    Happy Birthday to You
    

    FlipTack

    Posted 2014-10-13T11:15:15.893

    Reputation: 13 242

    1

    PHP, 68 65 bytes

    There are already 4 PHP answers, most of them shorter than this, but none using this feature, so:

    for(;$i++<4;)echo"
    Happy Birthday ",["to You","Dear PHP"][$i==3];
    

    Am I the only one noticing that there´s a comma missing?

    Titus

    Posted 2014-10-13T11:15:15.893

    Reputation: 13 814

    1Am I the only one noticing that there's a useless ?:0? – Christoph – 2017-04-21T13:43:50.560

    1

    COBOL, 185 Bytes

    IDENTIFICATION DIVISION.
    PROGRAM-ID. H.
    PROCEDURE DIVISION.
    PERFORM X.
    PERFORM X.
    DISPLAY 'Happy Birthday Dear COBOL'.
    PERFORM X.
    STOP RUN.
    X.
    DISPLAY 'Happy Birthday to You'.
    STOP RUN.
    

    I'm sure there is a shorter way but I don't know COBOL that well ;-)

    johan

    Posted 2014-10-13T11:15:15.893

    Reputation: 11

    1

    ;#, 11644 bytes

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;#
    

    Code generated by this brainfuck program

    caird coinheringaahing

    Posted 2014-10-13T11:15:15.893

    Reputation: 13 702

    Sorry, not a programming language. – Esolanging Fruit – 2017-06-04T06:54:16.910

    @Challenger5 it doesn't have to be. The challenge is tagged with kolmogorov-complexity – caird coinheringaahing – 2017-06-04T11:51:14.937

    1

    Minecraft, 120 bytes

    tellraw @a {"text":"Happy Birthday to You\nHappy Birthday to You\nHappy Birthday Dear Minecraft\nHappy Birthday to You"}
    

    Can be run by pasting into a command block and supplying power to it, or pasting into the chat with a slash at the start.

    LyricLy

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 313

    1

    VBA, 58 Bytes

    Anonymous VBE immediate window function that takes no input and makes VBA sing its own happy birthday song, alone.

    h="Happy Birthday ":t="to You":?h;t:?h;t:?h"Dear VBA":?h;t
    

    Taylor Scott

    Posted 2014-10-13T11:15:15.893

    Reputation: 6 709

    1

    T-SQL, 78 bytes

    SELECT a+b+a+b+a+c+a+b
    FROM(SELECT'Happy Birthday 'a,'to You
    'b,'Dear SQL
    'c)t
    

    SQL strings can include line breaks. If you are using SSMS, make sure to use "Results to Text" instead of "Results to Grid"

    I used a different technique than the two excellent SQL answers already here:

    If a leading newline is allowed (not mentioned in the rules or addressed in the comments), I can save one byte by moving the line break to the beginning of the 'Happy Birthday' string.:

    SELECT a+b+a+b+a+c+a+b
    FROM(SELECT'
    Happy Birthday 'a,'to You'b,'Dear SQL'c)t
    

    BradC

    Posted 2014-10-13T11:15:15.893

    Reputation: 6 099

    1

    REXX: 73 bytes

    n='Happy Birthday to You'   
    m='Happy Birthday Dear REXX'
    say n                       
    say n                       
    say m                       
    say n  
    

    SAY echoes the data and the output is

    Happy Birthday to You   
    Happy Birthday to You   
    Happy Birthday Dear REXX
    Happy Birthday to You                                           
    

    Srinivasan JV

    Posted 2014-10-13T11:15:15.893

    Reputation: 111

    1

    Python 3, 74 bytes i know it's too much

    b="Happy Birthday to You\n"
    print(b+b+b.replace("to You","Dear Python")+b)
    

    So like... I made the string, and then printed it, tore some off, added some more, and printed it. There ya go.

    Ben

    Posted 2014-10-13T11:15:15.893

    Reputation: 109

    It may be longer than the current shortest Python answer, but it's a to-the-point approach and a nice first answer nonetheless. +1 from me. Welcome to PPCG, and enjoy your stay! :)

    – Kevin Cruijssen – 2018-07-27T08:57:43.573

    Thanks! I think code golf is a lot of fun. It's just hard for me to think in code sometimes. – Ben – 2018-07-27T11:57:07.393

    1

    Whitespace, 373 bytes

    [N
    S T S 
    N_Call_Label_to_You\n][N
    S T 
    N_Call_Label_Happy_Birthday_][S S T T   S T T   T   S S N
    _Push_-92_newline][S S T    T   N
    _Push_-1_e][S S T   T   T   N
    _Push_-3_c][S S T   T   S T N
    _Push_-5_a][S S S T S T S N
    _Push_10_p][S S S T T   S T N
    _Push_13_s][S S T   T   N
    _Push_-1_e][S S S T T   T   S N
    _Push_14_t][S S S T T   N
    _Push_3_i][S S S T  S N
    _Push_2_h][S S T    T   T   T   T   N
    _Push_-15_W][S S T  T   S S S T T   S N
    _Push_-70_space][S S S T    T   S S N
    _Push_12_r][S S T   T   S T N
    _Push_-5_a][S S T   T   N
    _Push_-1_e][S S T   T   S S S T S N
    _Push_-34_D][N
    S T 
    N_Call_Label_Happy_Birthday_][N
    S T S 
    N_Call_Label_to_You\n][N
    S T 
    N_Call_Label_Happy_Birthday_][N
    S T S 
    N_Call_Label_to_You\n][N
    S T 
    N_Call_Label_Happy_Birthday_][N
    S S T   N
    _Create_Label_LOOP][S S S T T   S S T   T   S N
    _Push_102][T    S S S _Add][T   N
    S S _Print_as_character][N
    S N
    T   N
    _Jump_to_Label_LOOP][N
    S S N
    _Create_Label_Happy_Birthday_][S S T    T   S S S T T   S N
    _Push_-70_space][S S S T    S S T   T   N
    _Push_19_y][S S T   T   S T N
    _Push_-5_a][S S T   T   S N
    _Push_-2_d][S S S T S N
    _Push_2_h][S S S T  T   T   S N
    _Push_14_t][S S S T T   S S N
    _Push_12_r][S S S T T   N
    _Push_3_i][S S T    T   S S T   S S N
    _Push_-36_B][S S T  T   S S S T T   S N
    _Push_-70_space][S S S T    S S T   T   N
    _Push_19_y][S S S T S T S N
    _Push_10_p][S N
    S _Duplicate_top][S S T T   S T N
    _Push_-5_a][S S T   T   T   T   T   S N
    _Push_-30_H][N
    T   N
    _Return][N
    S S S N
    _Create_Label_to_You\n][S S T   T   S T T   T   S S N
    _Push_-92_newline][S S S T  T   T   T   N
    _Push_15_u][S S S T S S T   N
    _Push_9_o][S S T    T   T   S T N
    _Push_-13_Y][S S T  T   S S S T T   S N
    _Push_-70_space][S T    S S T   S N
    _Copy_2nd_o][S S S T    T   T   S N
    _Push_14_t][N
    T   N
    _Return]
    

    Letters S (space), T (tab), and N (new-line) added as highlighting only.
    [..._some_action] added as explanation only.

    Try it online.

    Explanation in pseudo-code:

    Call function to_You\n
    Call function Happy_Birthday_
    Push values for "\necapsetihW raeD" (reversed of "Dear Whitespace\n") to the stack
    Call function Happy_Birthday_
    Call function to_You\n
    Call function Happy_Birthday_
    Call function to_You\n
    Call function Happy_Birthday_
    Start LOOP:
      Integer i = top value of the stack
      i = i + 102
      Print i as character to STDOUT
      Go to next iteration of LOOP
    
    function Happy_Birthday_:
      Push values for " yadhtriB yppaH" (reversed of "Happy Birthday ") to the stack
      Return
    
    function to_You\n:
      Push values for "\nuoY ot" (reversed of "to You\n") to the stack
      Return
    

    Constant 102 was generated with this Java program, and used with this Whitespace tip of mine to print the text by putting the values reversed to the stack, and looping over them (adding the contant value, and printing them as character to the stack; which also exits as soon as we don't have any more values on the stack).

    In addition, the functions with return are used to prevent duplicated code for the repeated parts of the output-text. And there were two more things to golf:

    1. The value for the second p in "Happy" (which was SSSTSTSN - push 10) has been replaced with SNS (duplicate top).
    2. The value for the second o in "to You" (which was SSSTSSTN - push 9) has been replaced with STSSTSN (copy 2nd [1-indexed]). (Relevant Whitespace tip of mine.)

    Kevin Cruijssen

    Posted 2014-10-13T11:15:15.893

    Reputation: 67 575

    1

    brainfuck, 377 bytes

    --->-->->>>>>->->>>>>>>>->-->>>->>>>-->->>>>->>>>>>>>>>+[-[>+++++++<-]<+++]>---->+>++>->+>+>++>--->++>>+>++>>->->++>--->->++>+>--->-->+>++>->++>>->+>--->->+>->>+>>++>->>++++[----[>+++++++<-]<++++]>---->--->+++>>+>+>+++>-->--->+>+++>-->>+++>>+++>-->+>-->>-->->>->+>->--->>+++>-->+>+++>>+>->-->->++>+++>--[++<++++]>>[.>]>[.>]<<[<<]>[.>]>[.>]<<[<<]>[.>]>[>]>[.>]<[[<]<]>>[.>]>[.>]
    

    Try it online!

    Most of the code sets up "\nHappy Birthday \0to You\0Dear brainfuck". The last 64 instructions print it.

    Dorian

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 521

    1

    Pyth - 42 40 bytes

    J." y-÷\n3ª¼öj"K+J"to you"KK+J"dear Pyth"K
    
    J." y-÷\n3ª¼öj"                            Assign J to "Happy Birthday "
                   K+J"To you"                 Assign K to J + "to you"
                              KK               Print K twice
                                +J"dear Pyth"  Print J+"dear Pyth"
                                             K Print K
    

    Tornado547

    Posted 2014-10-13T11:15:15.893

    Reputation: 389

    1

    C (gcc) and aplay, 360, 175, 167, 151 bytes

    Generates the contents of a WAV file onto stdout, singing the melody of Happy Birthday. The output can then be piped to, for example, aplay to listen to it.

    Including -lm causes a +4 to score.

    Also, thanks to ceilingcat for golfing a couple dozen bytes.

    c,i;main(t,T){for(;i<25;i++)for(t=T="$$(((0$$(((0$$((((($$(((0"[i]-32<<9;t--;)putchar(c=sin(exp("!!#!&%!!#!(&!!-*&%#++*&(&"[i]/17.-2)*t)*9*t/T+9);}
    

    Try it online! (won't produce sound, duh...)

    Now available on Clyp for listening. Amplified for convenience, may be loud and/or pop on some devices.

    Try it offline!

    Compile and listen with gcc -w src.c -lm && ./a.out | aplay

    Degolf

    c,i;
    main(t,T) {
        for(;i<25;i++) // 25 notes of the song in the loop, 25 notes of the song
            for(t=T="$$(((0$$(((0$$((((($$(((0"[i]-32<<9; // Select number of samples
                    t--;)
                // See below, this has been mutilated quite a bit to golf it.
                // Assign to c for implicit cast to int.
                // A small shortcut is made by only dampening the sine-part of the wave.
                putchar(c=sin(exp("!!#!&%!!#!(&!!-*&%#++*&(&"[i]/17.-2)*t)*9*t/T+9);
    }
    

    A sine wave is defined as \$s(t)=A\cdot\sin 2\pi t\$. A sine wave with frequency \$f\$ can thus be expressed as \$s(ft)\$. Now, in this case \$\{t\in\mathbb N \mid0\leq t \leq T \}\$ and \$T:=n\cdot2^{11}\$, so we have to divide \$t\$ with 2048, in order to make the signal function work. Our function is now \$s(2^{-11}\cdot ft)\$.

    Since listing the frequencies would take a significant amount of bytes, I have encoded the frequencies as halfsteps relative to A4, represented by 40 or ( in the string. The frequency is thus obtained \$f=440Hz \cdot 2^{c-40\over12}\$. Finally, putting it all together, adding in some dampening and ensuring outputs greater than zero, we get:

    $$ f(t)= \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({880 \pi t \cdot 2^{c-40\over12}\cdot2^{-11}} \Big)\Bigg) $$

    $$ f(t)= \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({880 \pi t \cdot \exp\Big({{c\ln 2-40\ln 2\over12} - 11 \ln 2}}\Big) \Big)\Bigg) $$

    $$ f(t)= \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({ t \cdot \exp\Big({{c\ln 2-40\ln 2\over12} - 11 \ln 2 + \ln 880 \pi}}\Big) \Big)\Bigg) $$

    $$ f(t)\approx \Bigg({T - t\over T}\Bigg) \Bigg({A\over2}+{A\over2}\sin \Big({t \cdot \exp \Big({c\over17}-2\Big)} \Big)\Bigg) $$

    And finally, we select \${A\over2}=9\$ to conserve bytes.

    user77406

    Posted 2014-10-13T11:15:15.893

    Reputation:

    1

    Keg, 74 bytes

    (2|Happy Birthday to You\
    )
    Happy Birthday Dear Keg\
    Happy Birthday to You
    

    user85052

    Posted 2014-10-13T11:15:15.893

    Reputation:

    I feel like I may be seeing this again in 2 months! – Lyxal – 2019-09-15T01:12:49.477

    1

    PHP - 87 80 78 chars

    <? $h="<br>Happy birthday ";$t="to you";$d="dear PHP";echo "$h$t$h$t$h$d$h$t";
    

    I don't think that PHP is a good language for golfing, but I'm still practicing. And I love PHP :)

    For the command line (strip off the short tags and replace the <br> with \n) 73 chars:

    $h="\nHappy birthday ";$t="to you";$d="dear PHP";echo "$h$t$h$t$h$d$h$t";
    

    g.carvalho97

    Posted 2014-10-13T11:15:15.893

    Reputation: 139

    1I think you can skip the <? ?> because you can run it with -r on the command line. – hmatt1 – 2014-10-13T20:28:51.937

    2Even on a webpage, you don't need the closing ?>, two more chars saved. – OlivierTheOlive – 2014-10-17T15:55:37.340

    1@OlivierTheOlive Thanks. My PHP is a little rusty, I've not used it for a long time. – g.carvalho97 – 2014-10-17T18:16:21.570

    1

    PowerShell 79

    $a = 'Happy Birthday '
    $b = 'to You'
    "$a$b`n$a$b`n$($a)Dear PowerShell`n$a$b"
    

    Krove

    Posted 2014-10-13T11:15:15.893

    Reputation: 11

    1

    Railo CFML (79 characters)

    for(i=1;i<5;i++){writeoutput("<br>Happy Birthday "&(i<>3?"to you":"dear CF"));}
    

    Just having some fun creating a ridiculous mess:

      variables.endings = ["H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,t,o, ,y,o,u","H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,t,o, ,y,o,u","H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,d,e,a,r, ,C,o,l,d, ,F,u,s,i,o,n,n,n,n,n","H,a,p,p,y, ,B,i,r,t,h,d,a,y, ,t,o, ,y,o,u"];
      variables.iVerse = '';
      for (i = 1; i <= ArrayLen(variables.endings); i++) {
        variables.iLine = '';
        for (i2 = 1; i2 <= ListLen(variables.endings[i]); i2++) {
          iLine = iLine & ListGetAt(variables.endings[i],i2);
        }
        variables.iVerse = variables.iVerse & variables.iLine;
        if (i < ArrayLen(variables.endings)) {
          variables.iVerse = variables.iVerse & "<br />";
        }
      }
    
      writeOutput(variables.iVerse);
    

    Regular Joe

    Posted 2014-10-13T11:15:15.893

    Reputation: 111

    I know it's a little obvious what language this is, but please, describe what language you used and the character count of your code. Also, try to shorten it as much as you can. – g.carvalho97 – 2014-10-13T22:57:40.227

    @g.carvalho97 I was having too much fun, sorry. I'll fix it. – Regular Joe – 2014-10-13T23:01:54.270

    1

    Clojure : 87 chars

    Golfed:

    (let[h"Happy Birthday "s(str h"to You\n")t(str h"Dear Clojure\n")](print(str s s t s)))
    

    Ungolfed:

    (let [ h "Happy Birthday "
           s (str h "to You\n")
           t (str h "Dear Clojure\n") ]
    (print (str s s t s)))
    

    Michael Easter

    Posted 2014-10-13T11:15:15.893

    Reputation: 585

    1Or 81 with the similar (let[h"Happy Birthday "s"to You\n"t"Dear Clojure\n"](map #(print h %)[s s t s])) – tjb1982 – 2014-10-16T13:53:09.497

    1

    C: 87

    #define p(a)printf("Happy birthday %s\n",a?a:"to you");
    main(){p(0)p(0)p("dear C")p(0)}
    

    Demo

    Compiles fine, but since it doesn't return, it might not exit correctly. If you want it to return 0, it'll cost another seven characters:

    #define p(a)printf("Happy birthday %s\n",a?a:"to you");
    main(){p(0)p(0)p("dear C")return!p(0)}
    

    Demo

    millinon

    Posted 2014-10-13T11:15:15.893

    Reputation: 590

    1

    Common LISP, 169 bytes

    (defun birthday ()
       (princ "Happy Birthday to You")
       (princ "Happy Birthday to You")
       (princ "Happy Birthday dear Common LISP")
       (princ "Happy Birthday to You"))
    

    Output:

    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday dear Common LISP
    Happy Birthday to You
    

    Palagerini

    Posted 2014-10-13T11:15:15.893

    Reputation: 11

    5This is a [tag:code-golf] challenge but this isn't really golfed... – Alex A. – 2015-06-22T17:45:20.513

    1

    Burlesque - 55 Characters

    "Happy Birthday to You"4.*g_15.+"Dear Burlesque".+2iauN
    

    Test it here.

    AndoDaan

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 232

    "Happy Birthday " "to You"4.*"Dear Burlesque"3ia?+uN would be a shorter version. – mroman – 2015-09-25T11:45:29.593

    1

    Python 85

    [print('Happy Birthday %s'%('dear Python' if x==2 else 'to you')) for x in range(4)]
    

    sdamashek

    Posted 2014-10-13T11:15:15.893

    Reputation: 111

    2

    The if/else idiom can be generally shortened to a list selection: ['to you','dear Python'][x==2]. Instead of string formatting %, you can just use string concatenation. Take a look at some Python golf tips: http://codegolf.stackexchange.com/questions/54/tips-for-golfing-in-python

    – xnor – 2014-10-14T07:05:57.133

    1

    Cobra - 78

    class P
        def main
            print (t=(l='Happy Birthday ')+'to You\n')+t+l+'Dear Cobra\n'+t
    

    Οurous

    Posted 2014-10-13T11:15:15.893

    Reputation: 7 916

    1

    Scala 89 (also it is not my favourite)

    (1 to 4).map{i=>"Happy Birthday "+(if(i==3)"dear SCALA" else "to You")}.foreach{println}
    

    Maybe it could be less, it is just a default example, so feel free to improve.

    Regarding Java:

    If ignoring the excess stuff it is also possible to do a "import static java.lang.System.*;" and then use out.println. So something like this is possible (87 chars):

    int i=0;while(i<=3){out.println("Happy Birthday "+((i==2)?"dear Java":"to you"));i++;}
    

    (also it is longer than the solution from Stretch Maniac - see https://codegolf.stackexchange.com/a/39768)

    mackayver

    Posted 2014-10-13T11:15:15.893

    Reputation: 11

    1

    Python 3 - 61

    Based on @Falko's answer I made one for Python 3.3. I slightly improved his code by removing the space at the beginning of "Dear Python" and using the space between 'Birthday' and 'to'.

    H="\nHappy Birthday to You"
    print((H*3)[:60]+"Dear Python"+H)
    

    Total number of characters is 60 61.(thanks for the recount @manatwork)

    Edit:

    Two slightly different approaches, all with the same number of characters:

    T="\nHappy Birthday to You"
    print(T*2+T[:-6]+"Dear Python"+T)
    

    or

    print(T*2+T[:16]+"Dear Python"+T)
    

    BTW: I would like to post this as a comment, but I do not have the rep.

    Hennep

    Posted 2014-10-13T11:15:15.893

    Reputation: 111

    Sure about the 60 characters? Seems 61 to me. – manatwork – 2014-10-14T09:28:47.547

    @manatwork: you are right. Somehow my character counter gave the wrong output. It is also logic that I loss one character compared with Falko, because I need two parentheses and win one character by changing the "Dear Python" phrase. – Hennep – 2014-10-14T09:33:21.223

    1

    Befunge: 103

     >"yadhtriB yppaH"67+>:#,_1g:"0"-v
    2^_@#-"0"g20p10-1,,,,,,," to You"_1+01p"egnufeB raeD ">:#,_"0"02p#
    1
    

    karhell

    Posted 2014-10-13T11:15:15.893

    Reputation: 411

    1

    J Script(63)

    alert((a=(x="\nHappy Birthday ")+"to You")+a+x+"Dear JScript"+a)
    

    Why J Script and not Java Script? -3 bytes:)

    MegaTom

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 787

    I don't see why this has been downvoted... – Beta Decay – 2014-10-14T18:06:38.967

    1@BetaDecay coz JS is not the language name. – Optimizer – 2014-10-16T19:13:52.557

    @Optimizer Ah, I see now... – Beta Decay – 2014-10-16T19:18:20.070

    @Optimizer now it is the language name. – MegaTom – 2014-10-16T22:37:10.953

    1

    Befunge, 90

    Try it out here or here

    4v>$"uoY ot"     v
    v>0" yadhtriB yppaH" >:#,_$
    < |-2\+49\0:
     v>"egnufeB raeD">:#,_$1-:!#@_
    

    r3mainer

    Posted 2014-10-13T11:15:15.893

    Reputation: 19 135

    If I recollect correctly \r is the Mac OS linebreak; \r\n is the Windows linebreak; and \n is the *nix linebreak. – Bob Jarvis - Reinstate Monica – 2014-10-22T02:52:21.200

    Oops, yes I meant Mac (prior to OS X anyway). Apparently any of these line breaks should work according to the Funge-98 specs. I just checked the interpreter at compileonline.com and it seems happy to accept \r so I'll go with that.

    – r3mainer – 2014-10-22T08:11:05.003

    1

    C# (83)

    using System;
    
    for(int i=0;i<4;i++)Console.WriteLine("Happy Birthday "+(i!=2?"to You":"Dear C#"));
    
    //Happy Birthday To You
    //Happy Birthday To You
    //Happy Birthday Dear C#
    //Happy Birthday To You
    

    Equally short (83 Bytes of code) is:

    int i=0;while(i<4)Console.WriteLine("Happy Birthday "+(i++!=2?"to You":"Dear C#"));
    

    Tyress

    Posted 2014-10-13T11:15:15.893

    Reputation: 111

    1

    Bc: 62 characters

    (This demonstrates the language's only golfing strength: string literals are displayed even without the print statement.)

    while(i++<4){"Happy Birthday "
    if(i-3)"To You
    "else"Dear bc
    "}
    

    Sample run:

    bash-4.3$ bc <<< 'while(i++<4){"Happy Birthday "
    > if(i-3)"To You
    > "else"Dear bc
    > "}'
    Happy Birthday To You
    Happy Birthday To You
    Happy Birthday Dear bc
    Happy Birthday To You
    

    manatwork

    Posted 2014-10-13T11:15:15.893

    Reputation: 17 865

    1

    J : 53 bytes

    'Dear J'(57+i.6)"_}'to You',"1~,~,:~'Happy Birthday '
    

    ,"1~,~,:~ and (57+i.6)"_ can probably be golfed further.

    jpjacobs

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 440

    1

    Pascal (83) in maXbox

      const H='Happy Birthday to You';
      Speak(H+H+DelString(H,'to You')+'Dear Pascal'+H);
    

    See more: https://github.com/maxkleiner/maXbox3/releases

    Max Kleiner

    Posted 2014-10-13T11:15:15.893

    Reputation: 11

    1

    Clojure -- 79

    (map #(println"Happy Birthday"%)(assoc(vec(repeat 4"to You"))2"Dear Clojure"))
    

    tjb1982

    Posted 2014-10-13T11:15:15.893

    Reputation: 111

    1

    Clojure (104 76 characters)

    (let[h "Happy Birthday" t "to You\n"](print h t h t h "Dear Clojure\n" h t))
    

    which prints

    Happy Birthday to You
     Happy Birthday to You
     Happy Birthday Dear Clojure
     Happy Birthday to You
    

    Bob Jarvis - Reinstate Monica

    Posted 2014-10-13T11:15:15.893

    Reputation: 544

    1

    Mathematica (65)

    Print["Happy Birthday "<>#]&/@{s="to you",s,"dear Mathematica",s}
    

    Ryan Polley

    Posted 2014-10-13T11:15:15.893

    Reputation: 189

    Welcome to PPCG! As this is a code golf challenge, please add the byte count of your code next to the language name. – NinjaBearMonkey – 2014-10-16T03:57:45.130

    1

    Falcon: 61

    for i in[:4]:>"Happy Birthday "+(i==2?"Dear Falcon":"to You")
    

    globby

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 132

    1

    VBScript (75)

    h="Happy Birthday "
    l=vbLF
    t="to You"&l
    x=h&t
    WScript.Echo x&x&h&"Dear VBS"&l&x
    

    69 bytes if replacing WScript.Echo with MsgBox would be allowed.

    CommonGuy

    Posted 2014-10-13T11:15:15.893

    Reputation: 4 684

    1

    Rexx: 87

    p='a'x;h='Happy Birthday';i='to you';ooray='dear Rexx'p;!=h i;say h i p   h i p   h ooray !
    

    Output:

    Happy Birthday to you 
     Happy Birthday to you 
     Happy Birthday dear Rexx
     Happy Birthday to you
    

    aja

    Posted 2014-10-13T11:15:15.893

    Reputation: 141

    1

    C# (Full program) - 162

    namespace O{class P{static void Main(string[] a){for(int i=0;i<4;)System.Console.Write("Happy Birthday {0}\n",++i==3?"Dear god why do I golf in C#?":"to you");}}}
    

    Brandon

    Posted 2014-10-13T11:15:15.893

    Reputation: 257

    1"Dear god why do I golf in C#?" -- Try vba, it's worse. – RubberDuck – 2014-10-16T20:32:55.237

    1

    Javascript, 82

    Yet another different js entry

    a='Happy Birthday %s';b='to You\n';console.log(a+a+a+a,b,b,'Dear Javascript\n',b)
    

    pllee

    Posted 2014-10-13T11:15:15.893

    Reputation: 151

    1

    Delphi - 124 122 115

    Another Delphi XE2 try, this time without a loop.

    {$APPTYPE CONSOLE}const l=#13#10;y='to you'+l;h='Happy birthday ';d='dear Delphi'+l;begin
    Write(h+y+h+y+h+d+h+y)end.
    

    R-D

    Posted 2014-10-13T11:15:15.893

    Reputation: 231

    Write is enough there as the "Ln" part you output literally. – manatwork – 2014-10-17T09:08:06.683

    And again you're right :) – R-D – 2014-10-17T09:20:58.413

    1

    Rant, 58 54 chars

    [r:4]{Happy Birthday [alt:[nth:3;Dear Rant];to You]\N}
    

    Online Version

    How it Works:

    • [r:4] - Sets repetitions of next block to 4.
    • [alt: ... ; ...] - Executes alternate code if a primary pattern prints nothing.
      • [nth:3;Dear Rant] - Prints "Dear Rant" on the third iteration.
      • If the nth condition is not satisfied, the alt function prints to You.

    Berkin

    Posted 2014-10-13T11:15:15.893

    Reputation: 61

    1

    Intersystems Cache M, (71)

    S X="Happy Birthday "
    S Y="to You"
    S Z="Dear M"
    W X,Y,!,X,Y,!,X,Z,!,X,Y
    

    Sample run...

    USER>S X="Happy Birthday "
    
    USER>S Y="to You"
    
    USER>S Z="Dear M"
    
    USER>W X,Y,!,X,Y,!,X,Z,!,X,Y
    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday Dear M
    Happy Birthday to You
    

    LMSingh

    Posted 2014-10-13T11:15:15.893

    Reputation: 171

    1

    C++, 107

    Nice:

    #include <iostream>
    int main(){[](){}();//<-Good Luck Charm
        for (auto b : {false, false, true, false})
            std::cout << "Happy Birthday " << (b ? "Dear C++" : "To You") << '\n';
    }
    

    Golfed:

    #include <iostream>
    int main(){for(int b:"\0\0?")std::cout<<"Happy Birthday "<<(b?"Dear C++":"To You")<<'\n';}
    

    nwp

    Posted 2014-10-13T11:15:15.893

    Reputation: 241

    How should I compile this? gcc without any switch says: “nwp.cpp:2:22: error: range-based ‘for’ loops are not allowed in C++98 mode”. – manatwork – 2014-10-22T17:50:05.983

    @manatwork -std=c++11 should do the trick. – nwp – 2014-10-22T18:04:14.357

    Nope. :( http://pastebin.com/eZUpZXve BTW, its gcc 4.8.2 on Linux. As neither the ungolfed version compiles, I suppose on my side is broken something…

    – manatwork – 2014-10-22T18:19:55.203

    @manatwork Looks like gcc does not find the standard library. I don't know how exactly to fix that. You can semi-run the code at ideone.

    – nwp – 2014-10-22T18:49:36.550

    @manatwork Now I remember. Ignore the standard library comment. Instead of gcc use g++ to compile. – nwp – 2014-10-22T23:40:58.943

    Works! Thanks. I always suspected my C++ is insufficient, but now I got the proof. :S – manatwork – 2014-10-23T07:59:44.917

    1

    sh - 59

    echo "${h=Happy Birthday }${y=to You}
    $h$y
    ${h}Dear sh
    $h$y
    

    I thought this solution would be worth sharing too, even though there's a shorter one.

    nyuszika7h

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 624

    1

    K, 45 bytes

    No one has sung Happy Birthday for everyone's favorite in-memory columnar database language? There, there:

    `0:4 21#(57#"Happy Birthday to You"),"Dear K"
    

    Very similar to the APL approach by @Moris Zucca- repeat the string Happy Birthday to You slightly more than two times and then glue on the Dear K. Reshaping into a 4x21 matrix repeats the initial line. In K, sending text to stdout requires the 0: IO verb. Without it (for 3 fewer characters), we would print:

      4 21#(57#"Happy Birthday to You"),"Dear K"
    ("Happy Birthday to You"
     "Happy Birthday to You"
     "Happy Birthday Dear K"
     "Happy Birthday to You")
    

    An alternate 47 character solution I considered was:

    `0:("Happy Birthday ",("to You";"Dear K")2=)'!4
    

    This is about as straightforward as it gets- map a function over the sequence 0 1 2 3 given by !4, select the second half of the verse based on whether this index is equal to 2, glue on the start of the verse and then print the whole list out.

    JohnE

    Posted 2014-10-13T11:15:15.893

    Reputation: 4 632

    2There's no in-memory columnar database language I like better. – Dennis – 2015-06-28T20:56:48.570

    1

    JMP/JSL, 67

    Like the Mathematica example by David Carraher, this will 'sing' (...read) the Happy Birthday message to you out loud.

    speak(x="\!nHappy Birthday";y=x||" to You";y||y||x||" Dear JSL"||y)
    

    Output:

    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday Dear JSL
    Happy Birthday to You
    

    For 7 less bytes you will have the Happy Birthday message printed for you in the log

    Fried Egg

    Posted 2014-10-13T11:15:15.893

    Reputation: 91

    1

    SAS, 66 bytes

    data;a='Happy Birthday';b=a||' to You';put b/b/a 'Dear SAS'/b;run;
    

    Fried Egg

    Posted 2014-10-13T11:15:15.893

    Reputation: 91

    1

    Lua - 72 bytes

    Straightforward, but none of the other Lua programs work this way.

    a,b,c='Happy Birthday ','to You\n','Dear Lua\n'io.write(a,b,a,b,a,c,a,b)
    

    mlepage

    Posted 2014-10-13T11:15:15.893

    Reputation: 231

    1

    ><>, 157

    v
    \0&
    v                                   <
    \&:&2(?v
           >"Happy Birthday to you"a&1+&^
    \"Happy Birthday dear ><>"a\
    v  a"uoy ot yadhtriB yppaH"/
    r
    >l?!;o
    

    Big, but I wanted it to be different from the Befunge answer.

    phase

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 540

    1

    G*, 76 bytes

    G* is a golfing language I made but it seems it failed miserably :P (Note that this isn't even close to my favorite language but I wanted to give it a try at code golf.)

    l 2 p Happy birthday to you;p Happy birthday dear G*;p Happy birthday to you
    

    Here's another (longer) one:

    1=Happy birthday to you;@ 1;@ 1;p Happy birthday dear G*;p Happy birthday to you
    

    m654

    Posted 2014-10-13T11:15:15.893

    Reputation: 765

    1

    C#, 91 bytes

    var s="Happy Birthday to You\n";System.Console.Write(s+s+s.Substring(0, 15)+"Dear C#\n"+s);
    

    Goose

    Posted 2014-10-13T11:15:15.893

    Reputation: 219

    1

    beeswax, 66 chars

    Non-competing answer; I created beeswax in December 2015. This solution is just for fun.

    >`y Dear beeswax`5Np
    pb"M`adhtriB yppaH`<3~4_
    >`y To You`N~L;~   d
    

    You can clone the beeswax interpreter, language specifications and instructions from my GitHub repository.

    M L

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 865

    1

    Milky Way 1.6.5, 56 bytes

    I"Happy Birthday ":"Dear Milky Way"+;"to You"+::>>J§{!}
    

    Explanation

    I                                                        ` empty the stack
     "Happy Birthday "                                       ` push the string
                      :"Dear Milky Way"+                     ` make the 3rd line
                                        ;"to You"+::         ` make the 1st, 2nd and 4th lines
                                                    >>       ` put the lines in order
                                                      J§{!}  ` print each line
    

    Usage

    $ ./mw <path-to-code>
    

    Zach Gates

    Posted 2014-10-13T11:15:15.893

    Reputation: 6 152

    1

    F#, 76 bytes

    for i=0 to 3 do printfn"Happy Birthday %s"<|if i=2 then"Dear F#"else"to You"
    

    Roujo

    Posted 2014-10-13T11:15:15.893

    Reputation: 353

    1

    Golisp, 102 100 bytes (Non-competing)

    EDIT: Removed 2 bytes by changing the last writeln to write

    Non-competing since the language was posted after the creation of this challenge.

    write@*["Happy Birthday to You\n"2]writeln@"Happy Birthday Dear Golisp"write@"Happy Birthday to You"
    

    Ungolfed & commented version:

    write @ *["Happy Birthday to You\n" 2] # Call write with "Happy Birthday to You\n" repeated 2 times (f@x == f[x]) #
    writeln @ "Happy Birthday Dear Golisp" # Write "Happy Birthday Dear Golisp" to stdout #
    write @ "Happy Birthday to You" # Write "Happy Birthday to You" to stdout #
    

    TuxCrafting

    Posted 2014-10-13T11:15:15.893

    Reputation: 4 547

    0

    JavaScript, 70 Bytes

    a="Happy Birthday ";b=a+"to You\n";c=a+b;d=c+c+a+"Dear JavaScript\n"+c
    

    Best answer JavaScript answer so far!

    a="Happy Birthday ";
    b=a+"to You\n";
    c=a+b;                         // Create string "Happy Birthday to You\n"
    d=c+c+a+"Dear JavaScript\n"+c  // Create song
    

    Implementation:

    a="Happy Birthday ";b=a+"to You\n";c=a+b;d=c+c+a+"Dear JavaScript\n"+c
    alert(d);
    console.log(d);
    

    Julian Lachniet

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 216

    1You're not allowed to leave output in a variable. You have to write a full program which prints it or a function which returns it. – FlipTack – 2017-01-11T17:04:26.450

    0

    Edited Processing.js 80 bytes

    var a="\nhappy birthday to you";print(a+a+"\nHappy birthday processing.js"+a);
    

    Processing JS is a language that is fun but I am lazy and use an edited version that also is ungolfable. Try it online Println was used so you don't have to open the console :P

    Khanacademy version

    Christopher

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 428

    Ah, it's the Khan Academy version. Perhaps you should mention that somewhere (also, I believe the source code is here)

    – ETHproductions – 2017-03-06T23:33:22.013

    0

    ZPL (Zebra Programming Language), 112 bytes

    This is a just for fun answer.

    ^XA^FB137,4^FDHappy Birthday to You\&Happy Birthday to You\&Happy Birthday Dear ZPL\&Happy Birthday to You^FS^XZ
    

    Try It Online

    Explanation:

    ^XA                                # Start Format
        ^FB                            # Field Block
            137,                       # Width of text block line (in dots)
            4                          # Maximum number of lines in text block
        ^FD                            # Field Data
            Happy Birthday to You      # Hardcoded String
            \&                         # New Line (as allowed by the ^FB command)
            Happy Birthday to You      # Hardcoded String
            \&                         # New Line (as allowed by the ^FB command)
            Happy Birthday Dear ZPL    # Hardcoded String
            \&                         # New Line (as allowed by the ^FB command)
            Happy Birthday to You      # Hardcoded String
        ^FS                            # Field Separator
    ^XZ                                # End Format
    

    Note: The Zebra Programming Language is a printer control language that is not Turing complete.

    Grant Miller

    Posted 2014-10-13T11:15:15.893

    Reputation: 706

    0

    C, 74 bytes

    i=5;main(){while(--i)printf("Happy Birthday %s\n",i-2?"to You":"Dear C");}
    

    Detailed

    void main()
    {
        int i = 5;
    
        while (--i > 0)
        {
            printf("Happy Birthday %s\n",
            i!=2 ? "to You" : "Dear C" );
        }
    }
    

    Khaled.K

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 435

    You're supposed to write a program, not a function. Change f() to main() and it should be OK (but one character longer than V-X's answer).

    – r3mainer – 2017-04-19T11:44:42.793

    @squeamishossifrage fixed. – Khaled.K – 2017-04-19T12:48:51.553

    0

    C\C++ Preprocessor, 244 224 bytes

    Live in C

    Live in C++

    #define A "to"
    #define B "You"
    #define C "C"
    #ifdef __cplusplus
    #define C "C++"
    #endif
    #define D "Dear"
    #define E "Happy Birthday"
    #define H printf("%s %s %s \n",E,A,B)
    int main(){H;H;printf("%s %s %s \n",E,D,C);H;return 0;}
    

    Khaled.K

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 435

    You don't need the "return 0"... Also, too many whitespaces. Why do you split E and F? ... – user202729 – 2018-06-26T08:23:19.347

    @user202729 just made E and F the same thing, return is needed for it to work in C++ – Khaled.K – 2018-06-26T17:54:43.510

    0

    C++, 92 bytes

    #include<iostream> 
    int main(int c){for(c=4;c--;)std::cout<<"Happy Birthday "<<(c-1?"To You":"Dear C++")<<"\n";}
    

    Try it online

    Johan du Toit

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 524

    0

    Batch, 72 bytes

    @SET h=@ECHO Happy Birthday 
    %h%to You
    %h%to You
    %h%Dear Batch
    %h%to You
    

    Engineer Toast

    Posted 2014-10-13T11:15:15.893

    Reputation: 5 769

    0

    tcl, 69 68 65

    puts "[set t [set h Happy\ Birthday]\ To\ You]
    $t
    $h Dear tcl
    $t"
    

    demo

    sergiol

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 055

    0

    Fourier, 52 bytes

    |`Happy Birthday `|A|`to You
    `|BABABA`Dear Fourier
    `AB
    

    Try it online!

    Nothing particularly special except that it demonstrates that you can have newlines in string prints.

    Beta Decay

    Posted 2014-10-13T11:15:15.893

    Reputation: 21 478

    0

    Braingolf, 69 bytes

    "Happy Birthday to You
    "VR{.M}v&,6>[$_]"dear Braingolf
    "R!&@!&@v&@c&@
    

    Try it online!

    Explanation

    "Happy Birthday to You
    "
    

    Pushes "Happy Birthday to You\n" to the stack

    VR{.M}
    

    Creates a 2nd stack and duplicates the contents of the first stack to it, in reverse order

    v&,
    

    Switches to the 2nd stack and flips the entire stack

    6>[$_]
    

    Drops the last 7 items from the 2nd stack

    "dear Braingolf
    "
    

    Pushes "dear Braingolf\n" to the 2nd stack

    R!&@!&@
    

    Prints the contents of the first stack twice

    v&@
    

    Prints the contents of the 2nd stack

    c&@
    

    Prints the contents of the first stack

    Skidsdev

    Posted 2014-10-13T11:15:15.893

    Reputation: 9 656

    0

    Cubically, 813 bytes

    I guess this belongs here now too! Loops haven't been added to the language yet, so this is the best I can manage.

    +53@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6:5+3/1+552@6:3/1+552@6:5/1+3@6:5+3/1+54@6:3/1+552@6:5+53@6:1/1+1@6:5+3@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6:5+3/1+552@6:3/1+552@6:5/1+3@6:5+3/1+54@6:3/1+552@6:5+53@6:1/1+1@6:5+3@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6+4@6:2/1+551@6:5+2/1+55@6:5+1/1+552@6:5/1+3@6:4/1+52@6:5+53@6:5+3/1+55@6:5+1/1+551@6:5+51@6:5+2/1+55@6:5+52@66:4/1+553@6:1/1+1@6:5+3@6:5+2/1+55@6:4/1+552@66+1@6:5/1+3@6/1+52@6:5+1/1+551@6+1@6:5+3/1+552@6:5/1+551@6:1/1+551@6:5+2/1+55@6:4/1+553@6:5/1+3@6:5+3/1+552@6:3/1+552@6:5/1+3@6:5+3/1+54@6:3/1+552@6:5+53@6
    

    Try It Online!

    TehPers

    Posted 2014-10-13T11:15:15.893

    Reputation: 899

    0

    Pyth, 49 bytes

    Since the other Pyth answer is quite outdated and non-competing has been removed per meta consensus, here is a newer answer:

    K"Happy Birthday "J+K"to You\n"+*J2+K"Dear Pyth"J
    

    Try it online!

    Pyth, 50 bytes

    K+"Happy Birthday to You"b+++KK++<K15"Dear Pyth"bK
    

    Try it online!

    Mr. Xcoder

    Posted 2014-10-13T11:15:15.893

    Reputation: 39 774

    0

    AWK, 70 bytes

    BEGIN{for(x=-3;x<1;)print"Happy Birthday "(s=++x?"to You":"Dear AWK")}
    

    Try it online!

    I didn't see an AWK solution, so here we go. :)

    Robert Benson

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 339

    0

    SOGL V0.12, 29 bytes

    ‰║M─╬RS‘ūΖTtŗQQ"8Ν¼ģ^ļ&NZøe‘O
    

    Try it Here!

    dzaima

    Posted 2014-10-13T11:15:15.893

    Reputation: 19 048

    0

    Canvas, 43 bytes

    3[to You¶}Dear Canvas¶)«∑Happy Birthday 4*×
    

    Try it online!

    With notes (not valid code, as Canvas does not support comments):

    3[to You¶}                                      Push the string "to You\n" to the stack three times
                Dear Canvas¶                          Push the string "Dear Canvas\n" to the stack
                            )                        Compress the stack to an array
                              «                       Shift the array once to the left
                               ∑                      Join all strings in the array to one string
                                Happy Birthday 4*   Push the string "Happy Birthday " repeated four times vertically to the stack
                                                   ×  Concatenate the second object in the stack to the first object in the stack
                                                      Print the object at the top of the stack (implicit)
    

    hakr14

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 295

    40 bytes – dzaima – 2018-07-30T16:43:54.483

    0

    Add++, 55 bytes

    L,"Happy Birthday "dddB]"To You"ddV"Dear Add++"GBCBcB+n
    

    Try it online!

    caird coinheringaahing

    Posted 2014-10-13T11:15:15.893

    Reputation: 13 702

    0

    Python 2, 82 Bytes

    h="Happy Birthday";y='to You';d="Dear Python";print h,y,'\n',h,y,'\n',h,d,'\n',h,y
    

    Still getting my head around slicing...

    Allen Fisher

    Posted 2014-10-13T11:15:15.893

    Reputation: 219

    0

    Attache, 54 bytes

    Print=>4&("Happy Birthday "+2&"To You"'"Dear Attache")
    

    Try it online!

    Explanation

    2&"To You"'"Dear Attache"
    2&"To You"                  resizes "To You" into a 2-length array
              '"Dear Attache"   concatenate with "Dear Attache"
    
                                result: ["To You", "To You", "Dear Attache"]
    
    
    "Happy Birthday "+_         Adds this string to each element
                                result: ["Happy Birthday To You", "Happy Birthday To You", "Happy Birthday Dear Attache"]
    
    4&(_)                       Resizes the array to size 4
                                result: ["Happy Birthday To You", "Happy Birthday To You", "Happy Birthday Dear Attache", "Happy Birthday To You"]
    
    Print=>_                    Prints each member on its own line
    

    Conor O'Brien

    Posted 2014-10-13T11:15:15.893

    Reputation: 36 228

    0

    jamal, 57 characters

    {@for _(///dear jamal/0)Happy Birthday {@if/_/_/to You}
    }
    

    Sample run:

    bash-4.4$ jamal.pl birthday.jam 
    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday dear jamal
    Happy Birthday to You
    

    manatwork

    Posted 2014-10-13T11:15:15.893

    Reputation: 17 865

    0

    Charcoal, 56 bytes

    ≔Happy Birthdayη≔ to YouτP⁺ητ↓P⁺ητ↓P⁺η”↶ G↗5▶h…≡-⌕”↓P⁺ητ
    

    Try it online! (Link to the verbose version.)

    It wasn't fair that Charcoal still hadn't its own birthday party...

    Charlie

    Posted 2014-10-13T11:15:15.893

    Reputation: 11 448

    47 – ASCII-only – 2018-08-06T06:23:44.493

    0

    Noether, 54 bytes

    "Happy Birthday "~s"to You"+~mP?P?sP"Dear Noether"P?mP
    

    Try it online!

    Beta Decay

    Posted 2014-10-13T11:15:15.893

    Reputation: 21 478

    0

    MBASIC, 93 bytes

    1 FOR I=1 TO 4:PRINT"Happy Birthday ";:IF I=3 THEN PRINT"Dear MBASIC"ELSE PRINT"to You"
    2 NEXT
    

    wooshinyobject

    Posted 2014-10-13T11:15:15.893

    Reputation: 171

    0

    MathGolf, 45 bytes

    "Happy Birthday to You"·E<"Dear MathGolf"+\]n
    

    Try it online!

    maxb

    Posted 2014-10-13T11:15:15.893

    Reputation: 5 754

    wow this challenge is 4 years old now – qazwsx – 2018-10-06T01:43:04.667

    I was surprised that there weren't any answers from some newer golfing languages, but I like these simple challenges. With some string compression this answer could be shorter, but I haven't implemented that yet. – maxb – 2018-10-06T07:02:26.540

    0

    A0A0 - 309 bytes

    A0A0
    A0C3G1G1G1G1G1G1G1G1G1G1G1G1G1G1G1A0
    A0P72P97P112P112P121P32P66P105P114P116P104P100P97P121P32G3A0
    A0A1G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3A0
    G-3
    G1G4G7G4
    A0A0
    A0C3G1G1G1G1G1G1G1A0
    A0P116P111P32P89P111P117P10G3A0
    A0A1G-3G-3G-3G-3G-3G-3G-3A0
    G-3
    G-8G-8
    P68P65
    P101P48
    P97P65
    P114P48
    P32P10
    G-5G-14
    

    Explanation:

    A0A0
    A0C3G1G1G1G1G1G1G1G1G1G1G1G1G1G1G1A0
    A0P72P97P112P112P121P32P66P105P114P116P104P100P97P121P32G3A0
    A0A1G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3G-3A0
    G-3
    

    Creates a loop which prints "Happy Birthday " and jumps every iteration.

    G1G4G7G4
    

    The positions the code should jump to each iteration.

    A0A0
    A0C3G1G1G1G1G1G1G1A0
    A0P116P111P32P89P111P117P10G3A0
    A0A1G-3G-3G-3G-3G-3G-3G-3A0
    G-3
    

    Creates a loop which will print "to you" and jumps out of the loop after each iteration.

    G-8G-8
    

    More positions to jump to, but this time for the second loop (also acts as a sort of counter, adding an additional G-8 would print "Happy Birthday " one more time).

    P68P65
    P101P48
    P97P65
    P114P48
    P32P10
    G-5G-14
    

    Prints "Dear A0A0" and jumps back to the first loop.

    Test it here.

    user83174

    Posted 2014-10-13T11:15:15.893

    Reputation:

    0

    Cubically, 251 bytes

    ⇒:4+@:5+2/1+55@+2S-0@@S'+1@f2/1+52@F+5@F'+1@:4/1+6255@U-1@U'/6+1*@S-0@S'+1/1*@f2
    ⇒:5/1+3@
    ⇒/6+6366@/4+552@f2/67+55@/3+552@B+1@B'/6+1@
    f1f3f1f3f1//3+6635@/3+551@:5+2/1+55@/3+6552@f2+/3+165@-6+355@/6++++55@/3+6551@:1+55@:5+2/1+55@:2+55@@/6+61*@/6+1@f1f3
    

    Try it online!

    Explanation:

    First, second and third lines are functions.
    First line prints "Happy Birthday " (note the trailing space)
    Second line prints a space (to golf it down)
    Third line prints "to You\n"

    Fourth line is the program. It simply calls functions and prints "Dear Cubically\n" on the third line.

    u_ndefined

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 253

    0

    Gol><>, 55 bytes

    a"Happy birthday to you"3F6sK|6sR}a"Dear Gol><>"6sR{r~H
    

    Voila, explanation coming soon!

    Try it online!

    KrystosTheOverlord

    Posted 2014-10-13T11:15:15.893

    Reputation: 681

    0

    05AB1E, 29 bytes

    ”to€î”Д¬Ž 05AB1E”s)”ŽØ¢© ”ì»
    

    Try it online!

    ”to€î”                 # dictionary string "to You"
          Ð                # triplicate
    ”¬Ž 05AB1E”            # dictionary string "Dear 05AB1E"
               s           # swap
                )          # wrap entire stack in an array
    ”ŽØ¢© ”                # dictionary string "Happy Birthday "
           ì               # prepend to each string in the array
            »              # join array by newlines
    

    Grimmy

    Posted 2014-10-13T11:15:15.893

    Reputation: 12 521

    0

    Stax, 33 bytes

    Çÿ╣á╕♠½ß¡U¶[k╔╒j⌂?6▓╓○÷⌂I╬&⌂Γ╚?╟A
    

    Run and debug it

    Oliver

    Posted 2014-10-13T11:15:15.893

    Reputation: 7 160

    0

    Stax, 28 bytes

    ▄Jÿø•2╜x!╨¬r├^↑#8╕Γ☺°7¿5⌠☻U▄
    

    Run and debug it at staxlang.xyz!

    I'm two weeks late. Alas. But it's short, at least...

    Unpacked (34 bytes) and explanation:

    `/&tpz/b}"=J:J=P*``!0 ZrO"`n)ncLmT
    
    `/&tpz/b}"=J:J=P*`                    Literal "Happy Birthday to You   "
                      `!0 ZrO"`           Literal "Dear Stax"
                               n          Copy the first line to the top of the stack
                                )         Overwrite end with "Dear Stax"
                                 nc       Copy the first line twice more to the top
                                   L      Collect stack in a list
                                    mT    Print each, trimmed of trailing spaces, on its own line
    

    If you're fine with those three trailing spaces, drop the T for 33 bytes unpacked. Still 28 packed, unfortunately.

    Khuldraeseth na'Barya

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 608

    0

    GolfScript, 49 bytes

    Just a blatant port of the CJam answer.

    "Happy Birthday to You
    "...15<"Dear GolfScript
    "@
    

    Try it online!

    user85052

    Posted 2014-10-13T11:15:15.893

    Reputation:

    A month earlier and this would have been a proper salutation to Golfscript – Lyxal – 2020-01-22T09:38:49.057

    0

    Wren, 78 bytes

    I have forgotten about Wren so I'm trying to use it.

    Fn.new{(1..4).map{|i|"Happy Birthday "+(i==3?"Dear Wren":"to You")}.join("
    ")}
    

    Try it online!

    user85052

    Posted 2014-10-13T11:15:15.893

    Reputation:

    0

    W d, 34 bytes

    Short language name to the rescue!

    W is just 0.0833 years old but I'm still posting this ... Insanely long but oh well.

    ♣∙♥ª¬^╗Γë├ΦñtQOi▼!◙╖☼▓Φ◙ï╔♀EÞr!R╫J
    

    Explanation

    4                                       E % Foreach in the range from 1 to 4:
     "Happy Birthday "                        % Append the string "Happy Birthday "
                      a3=                     % If this is the third line:
                         "Dear W"&            % Output "Dear W"
                                  "to You"|   % Otherwise, output "to You"
                                           +  % Join the two strings.
                                              % Output a newline.
    

    user85052

    Posted 2014-10-13T11:15:15.893

    Reputation:

    0

    JavaScript (84 76 bytes)

    x=`Happy Birthday To You\n`,alert(x+x+`Happy birthday Dear JavaScript\n`+x)

    Output:

    Happy Birthday To You
    Happy Birthday To You
    Happy Birthday Dear JavaScript
    Happy Birthday To You
    

    Lebster

    Posted 2014-10-13T11:15:15.893

    Reputation: 21

    1You have an extra “s” in “JavaScript”. And x+x is shorter than x.repeat(2). – manatwork – 2020-01-22T12:01:54.263

    0

    Golfscript, 56 bytes

    Thanks, professorfish!

    "Happy Birthday ":h"to You\n"+:s s h"dear Golfscript\n"s
    

    Output:

    Happy Birthday to You
    Happy Birthday to You
    Happy Birthday dear Golfscript
    Happy Birthday to You
    

    Beta Decay

    Posted 2014-10-13T11:15:15.893

    Reputation: 21 478

    1You don't need to concatenate them; they'll all be printed anyway – None – 2014-10-13T19:17:09.793

    1and you seem to do "Happy Birthday ":h;h - why do you need to pop the value and then push it again? "Happy Birthday ":h will have the same effect AFAIK. same for :s;s – None – 2014-10-13T19:32:32.103

    0

    JavaScript, 73

    Run this in the console

    for(h="",i=4;i;)h+='\nHappy Birthday '+(--i-1?'to You':'Dear JavaScript')
    

    xem

    Posted 2014-10-13T11:15:15.893

    Reputation: 5 523

    I think it would be easier to just declare the happy birthday 4 times than to loop it. – Goose – 2015-12-30T14:31:04.333

    0

    PowerShell 92 (fixed)

    $a="happy birthday to you";$a;$a;write-host -no  $a.TrimEnd('to you');"y dear powershell" ;$a
    

    this one is longer than the other PS solution but is unique and actually out puts the correct string

    OLD -Powershell- - 62

    $a="happy birthday to you";$a;$a;write "$a dear powershell";$a
    

    Jae

    Posted 2014-10-13T11:15:15.893

    Reputation: 27

    1It looks to me like that will print the third line as "happy birthday to you dear powershell", which is not correct. – Bob Jarvis - Reinstate Monica – 2014-10-17T22:45:39.727

    0

    C++, 136

    #include<iostream>
    int main(){static int i=0;std::cout<<"Happy Birthday "<<(i==2?"Dear C++":"to You")<<std::endl;return ++i<4?main():0;}
    

    android927

    Posted 2014-10-13T11:15:15.893

    Reputation: 1

    0

    B - 109

    (caveat: arguably not valid B, difficult to say - works with this)

    main()v(4,"Happy Birthday to You   HDear B");v(i,s){s[5]=i&5?'u':134744072;s[6]=&-247;i?puts(s)&v(i-1,s):0;}
    

    Leushenko

    Posted 2014-10-13T11:15:15.893

    Reputation: 1 500

    0

    EcmaScript 6 - 64 о_О

    [1,1,0,1].map(i=>"Happy Birthday "+(i?"to you":"ES6")).join("\n")
    

    Qwertiy

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 697

    Unfortunately, this does not completely follow the spec: you need to have "dear" before the language name, you have to write out "JavaScript", as per the other JS answers, and you have to provide a way of outputting the result so it can be a stand-alone program (console.log in this case.) – NinjaBearMonkey – 2014-10-15T23:07:33.843

    Than that's the fix (83): alert([1,1,0,1].map(i=>"Happy Birthday "+(i?"to you":"Dear EcmaScript")).join("\n")) – Qwertiy – 2014-10-15T23:28:14.713

    By the way, solution http://codegolf.stackexchange.com/a/39770/32091 does not do any output and uses latest evaluation output in console like mine.

    – Qwertiy – 2014-10-15T23:31:03.857

    True, but that one should also have its own method of output. – NinjaBearMonkey – 2014-10-15T23:45:27.070

    0

    ><> 76 Bytes

    Since it wasn't here already...

    0>"Happy Birthda"{1+:}3-?vv
    v^?=1l<;?=5}:{a"uoY oT y"<>"y Dear ><>"a
    >{{o} ^
    

    Fongoid

    Posted 2014-10-13T11:15:15.893

    Reputation: 971

    0

    JS 70 Bytes

    alert([c=(a="Happy Birthday")+" to You",c,a+" Dear JS",c].join("\n"));
    

    Thomas Junk

    Posted 2014-10-13T11:15:15.893

    Reputation: 131

    0

    Swift, 68 bytes

    (1...4).map{print("Happy Birthday "+($0==3 ?"dear Swift":"to You"))}
    

    also differently:

    print({$0+$1+$0+$1+$0+"dear Swift"+$0+$1}("\nHappy Birthday ","to You"))
    

    with 71 bytes

    Kametrixom

    Posted 2014-10-13T11:15:15.893

    Reputation: 426

    Another 70-byte alternative: for i in 1...4{print("Happy Birthday "+(i==3 ?"Dear Swift":"to You"))} – Mr. Xcoder – 2017-08-03T06:22:04.780

    0

    HPPPL (HP Prime Programming Language), 88

    n:=char(10);a:="Happy Birthday ";b:="To You";c:="Dear HPPPL";d:=a+b+n;print(d+d+a+c+n+d)
    

    Result:

    Happy Birthday To You HPPPL

    HPPPL is the programming language for the HP Prime color graphing calculator/CAS. An emulator is available at the HP website.

    M L

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 865

    0

    Sprects, 49 bytes

    .12121Dear Sprects\n12.1Happy Birthday .2to You\n
    

    Try it here

    DanTheMan

    Posted 2014-10-13T11:15:15.893

    Reputation: 3 140

    0

    Stringy, 78 bytes

    (Happy birthday );a to you;p;p;^ to you!dear Stringy;p;^ dear Stringy!to you;p
    

    m654

    Posted 2014-10-13T11:15:15.893

    Reputation: 765

    0

    Mouse-2002, 70 bytes

    Mouse isn't very skilled at . :(

    $H"Happy Birthday "@
    $Y"to you!"@
    #H;#Y;#H;#Y;#H;"Dear Mouse!"#H;#Y;$
    

    The exclamation points print newlines, not themselves, and the $H and $Y are functions, not variables, because poor Mouse can't comprehend strings.

    MUSYS, MUsic-SYStem, Mouse's predecessor, 93 bytes

    "Happy Birthday to you!Happy Birthday to you!Happy birthday dear MUSYS!Happy Birthday to you"
    

    cat

    Posted 2014-10-13T11:15:15.893

    Reputation: 4 989

    0

    Staq, 67 66 chars

    {h"Happy Birthday "}{T"To You"}{D"Dear Staq"}{N&iiqi,;}hTNhTNhDNhT
    

    Result:

    Executing D:\codegolf\Happy Birthday Staq.staq
    
    Happy Birthday To You
    Happy Birthday To You
    Happy Birthday Dear Staq
    Happy Birthday To You
    
    Execution complete.
    >
    

    M L

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 865

    -2

    C# LinqPad, 103 bytes

    Regex.Replace(String.Join("\n",Enumerable.Repeat("Happy Birthday to You",4)),"^((.*\n){2}.*)to.+","$1C#")
    

    Qwertiy

    Posted 2014-10-13T11:15:15.893

    Reputation: 2 697