Anonymous user
Execute HQ9+: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 294:
<lang ela>each writen <| eval "HQ9+"</lang>
=={{header|Forth}}==▼
<lang forth>variable accumulator▼
: H cr ." Hello, world!" ;▼
: Q cr 2dup type ;▼
: 9 99 verses ; \ http://rosettacode.org/wiki/99_Bottles_of_Beer#Forth▼
: + 1 accumulator +! ;▼
: hq9+ ( "code" -- )▼
parse-word 2dup bounds ?do▼
i 1 [ get-current literal ] search-wordlist▼
if execute else true abort" invalid HQ9+ instruction"▼
then loop 2drop ;</lang>▼
Line 340 ⟶ 324:
io:format("~n"),
bottle(N), io:format("of beer on the wall~n"),
inc(Acc) ->
Line 374 ⟶ 358:
}</lang>
▲=={{header|Forth}}==
▲<lang forth>variable accumulator
▲: H cr ." Hello, world!" ;
▲: Q cr 2dup type ;
▲: 9 99 verses ; \ http://rosettacode.org/wiki/99_Bottles_of_Beer#Forth
▲: + 1 accumulator +! ;
▲: hq9+ ( "code" -- )
▲ parse-word 2dup bounds ?do
▲ i 1 [ get-current literal ] search-wordlist
▲ if execute else true abort" invalid HQ9+ instruction"
▲ then loop 2drop ;</lang>
|