Anonymous user
99 bottles of beer: Difference between revisions
→{{header|Battlestar}}
Spintronic (talk | contribs) (99 Bottles with Algae language) |
|||
Line 695:
const nl = "\n"
//
var x 1024
// Write two digits, based on the value in a
fun printnum
b = a
break (a < 10)▼
a /= 10
// modulo is in the d register after idiv
Line 705 ⟶ 707:
a += 48 // ASCII value for '0'
print(chr(a))
break▼
end
a = b
Line 723 ⟶ 724:
// N, "bottles of beer on the wall, "
// Retrieve and print the number
Line 733 ⟶ 735:
printnum()
// N, "bottles of beer.\nTake one down and pass it around,"
// "Take one down and pass it around,"▼
▲ print(takedown)
// N-1, "bottles of beer on the wall."
stack -> a
a--
// Store N-1, used just a few lines down
a -> stack
printnum()
print(bottle)
// Retrieve N-1
stack -> a
// Write an "s" if the count is not 1
a != 1
print(plural)
end
//
// Skip to the top of the loop while the counter is >= 2
Line 771 ⟶ 775:
a = 1
printnum()
// "1
a = 1
printnum()
print(takedown)▼
▲ // "bottle of beer. Take one down and pass it around,"
// "no more bottles of beer on the wall."
▲ print(l_no)
// Blank line
▲ print(nl)
// "No more bottles of beer on the wall,"
▲ print(sep)
// "no more bottles of beer."
print(l_no)▼
print(more)▼
// "Go to the store and buy some more,"
x += l_no
x += more
x += sep
x += l_no
x += more
x += store
// "99
a = 99
printnum()
// "bottles of beer on the wall."
x += wall
x += dotnl
end
end
|