How can I get 10#1$result to work correctly?

When creating a calculator for adding two numbers I am adding together by transversing the digits from small to large. e.g. for adding 51 plus 51 I am adding 1+1, storing the "2", then adding 5+5, storing the "0" and then adding the 1 at the beginning.

To do this I am using result=1$result

However I run into problems with numbers that have 8 and 9 in them. I discovered this recently and was able to solve it then by preceding it with 10#, e.g.


However with the need for the "1" at the start for when I have a "10" as the result (record 0, then add the "1" at the start) I can't get the base 10 syntax to work right. I've tried:


The correct format is simply to use:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.