Lua - 217 164 154 151 149 143
Modified the old one to use a loop instead, saves a boat-load of characters. Thanks to TeunPronk for helping me shave off another 10 characters and to WilliamBarbosa for shaving off another 3 characters. 2 more characters can be saved by using the variable k
. 6 more characters are saved by eliminating the variable r=" rock,"
since it is used once.
o=" o'clock"c=", "w=io.write k=1+1 for i=1,11,k+k do w(i,c,i+1,c,i+k,o,c,i+k+1,o," rock,\n")end w("We're gonna rock around the clock tonight.")
Ungolfed,
o=" o'clock"
c=", "
w=io.write
k=1+1
for i=1,11,k+k do
w(i,c,i+1,c,i+k,o,c,i+k+1,o," rock,\n")
end
w("We're gonna rock around the clock tonight.")
1There are spaces at the end of first 3 lines, do those count? – aditsu quit because SE is EVIL – 2014-07-17T12:46:11.090
@aditsu: These are due to editing, as m.buettner forgot to remove them when editing back to a code block. I would amend this, but the edit is considered too minor. – Wrzlprmft – 2014-07-17T12:56:24.743
1I removed them now – aditsu quit because SE is EVIL – 2014-07-17T13:30:11.430
4Several answers use
11
. Does the instruction mean you can only use the number 1 or the digit 1? – mfvonh – 2014-07-17T16:32:21.32310@mfvonh I said you could use
1
. I didn't specify how many times, so the fact that people have used11
is a clever loophole, and I'm all for it. – rybo111 – 2014-07-17T17:17:06.213what if character literals in my language of choice are 8-bit integers? – Sparr – 2014-08-18T02:17:53.767
@Sparr Post it anyway, but put a note for others – rybo111 – 2014-08-18T10:02:47.460