Execute HQ9+: Difference between revisions
Content added Content deleted
(→{{header|PARI/GP}}: appen =={{header|Pascal}}==) |
(Added solution for Action!) |
||
Line 233: | Line 233: | ||
sim> ex 0252 |
sim> ex 0252 |
||
252: 04 |
252: 04 |
||
</pre> |
|||
=={{header|Action!}}== |
|||
<lang Action!>PROC Run(CHAR ARRAY code) |
|||
BYTE i,a |
|||
CHAR c |
|||
PrintF("Run ""%S""%E%E",code) |
|||
a=0 |
|||
FOR i=1 TO code(0) |
|||
DO |
|||
c=code(i) |
|||
IF c='q OR c='Q THEN |
|||
PrintE(code) |
|||
ELSEIF c='h OR c='H THEN |
|||
PrintE("Hello, world!") |
|||
ELSEIF c='9 THEN |
|||
PrintE("99 bottles here...") |
|||
ELSEIF c='+ THEN |
|||
a==+1 |
|||
ELSE |
|||
PrintF("Unrecognized character '%C'%E",c) |
|||
Break() |
|||
FI |
|||
OD |
|||
PrintF("%EAccumulator=%B%E",a) |
|||
RETURN |
|||
PROC Main() |
|||
Run("9++hQ+q9H+") |
|||
RETURN</lang> |
|||
{{out}} |
|||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Execute_HQ9+.png Screenshot from Atari 8-bit computer] |
|||
<pre> |
|||
Run "9++hQ+q9H+" |
|||
99 bottles here... |
|||
Hello, world! |
|||
9++hQ+q9H+ |
|||
9++hQ+q9H+ |
|||
99 bottles here... |
|||
Hello, world! |
|||
Accumulator=4 |
|||
</pre> |
</pre> |
||