AHQ9+-

From Esolang
Jump to navigation Jump to search

AHQ9+- is an extension of HQ9+, which adds the following instructions:

  • A : print the value of the accumulator;
  • - : decrement the accumulator.

Python intepreter

accumulator=0
cmds=input(">>> ")
for cmd in cmds:
    if cmd.lower() == "a":
        print(accumulator)
    elif cmd.lower() == "h":
        print("Hello, world!")
    elif cmd.lower() == "q":
        print(cmds)
    elif cmd == "9":
        for i in range(99, 2, -1):
            print(str(i)+" bottles of beer on the wall, "+str(i)+" bottles of beer.\nTake one down, pass it around, "+str(i-1)+" bottles of beer on the wall.")
        print("2 bottles of beer on the wall, 2 bottles of beer.\nTake one down, pass it around, 1 bottle of beer on the wall.")
    elif cmd == "+":
        accumulator+=1
    elif cmd == "-":
        accumulator-=1
input()

See also