RosettaCodeData/Task/Execute-HQ9+/BBC-BASIC/execute-hq9+.basic

23 lines
694 B
Plaintext

PROChq9plus("hq9+HqQ+Qq")
END
DEF PROChq9plus(code$)
LOCAL accumulator%, i%, bottles%
FOR i% = 1 TO LEN(code$)
CASE MID$(code$, i%, 1) OF
WHEN "h","H": PRINT "Hello, world!"
WHEN "q","Q": PRINT code$
WHEN "9":
bottles% = 99
WHILE bottles%
PRINT ;bottles% " bottles of beer on the wall, ";
PRINT ;bottles% " bottles of beer,"
bottles% -= 1
PRINT "Take one down, pass it around, ";
PRINT ;bottles% " bottles of beer on the wall."
ENDWHILE
WHEN "+": accumulator% += 1
ENDCASE
NEXT i%
ENDPROC