Excuse me,
I am currently doing Lab 5
I am trying to check if the number input by users is 1, then answer accordingly.
Here's the code that I attempted:
@: animal
animal: duck|ducks rabbit|rabbits chicken|chickens horse|pony|horses|ponies alligator|alligators
assoc: feet
{{
:duck 2
:rabbit 4
:chicken 2
:horse 4
:ducks 2
}} +feet
Q: $x.@int $animal
A: ${ $x int 1 > } ? % $animal have ${ $x int $animal feet * } feet
A: $animal has ${ $animal feet } feet
--
Q: $animal
A: $animal has ${ $animal feet } feet
--
However when I test in the main.m with 2 ducks as input.
It gives me two errors
ERROR: Attempting to use the compilation word 'THEN' in interpretation mode.
ERROR: null
How could I make this works??
Thanks in advance for the help