Execute HQ9+: Difference between revisions

Added Dyalect programming language
m (→‎{{header|NS-HUBASIC}}: The code no longer uses "X$=(X or Y)$+CHR(13) commands, but still works correctly, and any THEN or GOTO commands are more readable, as one space is now before them for each command, compared to the previous no spaces.)
(Added Dyalect programming language)
Line 682:
end;
end;</lang>
 
=={{header|Dyalect}}==
 
<lang dyalect>func eval(code) {
var accumulator = 0
var opcodes = (
"H": () => print("Hello, World!"),
"Q": () => print(code),
"9": () => {
var quantity = 99
while quantity > 1 {
print("\(quantity) bottles of beer on the wall, \(quantity) bottles of beer.")
print("Take one down and pass it around, \(quantity - 1) bottles of beer.")
quantity -= 1
}
print("1 bottle of beer on the wall, 1 bottle of beer.")
print("Take one down and pass it around, no more bottles of beer on the wall.\n")
print("No more bottles of beer on the wall, no more bottles of beer.")
print("Go to the store and buy some more, 99 bottles of beer on the wall.")
},
"+": () => accumulator += 1
)
 
for c in code {
opcodes[c.upper()]()
}
}</lang>
 
=={{header|E}}==
Anonymous user