Execute HQ9+: Difference between revisions

no edit summary
No edit summary
Line 1,679:
Hello, world!
Hello, world!
</pre>
 
=={{header|Ring}}==
<lang ring>
bottle("hq9+HqQ+Qq")
func bottle(code)
accumulator = 0
for i = 1 to len(code)
switch code[i]
on "h"
see "Hello, world!" + nl
on "H"
see "hello, world!" + nl
on "q"
see code + nl
on "Q"
see code + nl
on "9"
bottles = 99
while bottles > 0
see "" + bottles + " bottles of beer on the wall, "
see "" + bottles + " bottles of beer," + nl
bottles = bottles - 1
see "take one down, pass it around, "
see "" + bottles + " bottles of beer on the wall." + nl
end
on "+"
accumulator = accumulator + 1
off
next
</lang>
Output:
<pre>
Hello, world!
hq9+HqQ+Qq
99 bottles of beer on the wall, 99 bottles of beer,
Take one down, pass it around, 98 bottles of beer on the wall.
98 bottles of beer on the wall, 98 bottles of beer,
Take one down, pass it around, 97 bottles of beer on the wall.
...
3 bottles of beer on the wall, 3 bottles of beer,
Take one down, pass it around, 2 bottles of beer on the wall.
2 bottles of beer on the wall, 2 bottles of beer,
Take one down, pass it around, 1 bottles of beer on the wall.
1 bottles of beer on the wall, 1 bottles of beer,
Take one down, pass it around, 0 bottles of beer on the wall.
Hello, world!
hq9+HqQ+Qq
hq9+HqQ+Qq
hq9+HqQ+Qq
hq9+HqQ+Qq
</pre>
 
2,468

edits