Is there an object that can do this? 1 + 1 = 11.
Hello! I'm looking for an object that can add two numbers up, but not like 1 + 1 = 2 or 2 + 3 = 5.
Instead I'm looking for something which takes the two numbers and outputs a number in this way, as if you were simply putting the two numbers side by side:
1 + 1 = 11
2 + 3 = 23
5 + 2 = 52
52 + 46 = 5246
And so forth..
I'm new relatively to Max and the reason I am doing this is to create an AND-gate. Addition wouldn't work because I want 2 + 3 and 3 + 2 to result in unique outputs (23 and 32 respectively) whereas with addition they would both result in 5.
Thanks a lot for any info!
Johannes C
You could use sprintf to format the output and then convert the string to an integer
sounds like you just need reformatting... 'sprintf' can do this pretty easily, among other ways:

or [combine]
ha, Anthony beat me to it :)
and Schlam gave a good one, too...
i have Roman Thilenius's forum-personality in my head right now, too, he's writing:
"you could also do it mathematically, take the number of digits in the one operand, now take 10 to that number of power and multiply that by the other operand, allowing them both to simply be added together after that, for example:
52 + 46( with 2 digits in the second operand of '46' you would use '10^2' or '100' as the multiplier/coefficient by which to transform the first operand of '52')
= (100 * 52) + 46 = 5246
it's just the decimal-based numeric system after all ;)
-110"
Hello you all, thank you so much for the responses!
I just saw your replies. It's super late here so I'll go to bed now but I'll take a look at everything tomorrow.
Thanks a lot for the quick replies! = )
Hi again everyone.
I ended up using the sprintf object as previously suggested and it worked perfectly. I've also kept Schlam's combine method for further reference. Quite clever, multiplying by 100 as a solution. I wish I had thought of that, I would've felt so smug had I figured that out. I guess if the second operand is only a single digit you would instead multiply the first operand by 10 for the same result. So (4 * 10) + 2 = 42 for example. Or if the second operand has three digits you would need to multiply the first operand by 1000. So (24 * 1000) + 585 = 24585.
Very useful tips, thanks again everyone!
if the second operand is only a single digit you would instead multiply the first operand by 10 for the same result
ya exactly(the number of digits determines the number of power to take 10 by, so a single digit just means 10 to the first power(10^1) which is still 10)...you got it right🍻
sorry, i was just being humorous with that one 😁 over the years, Roman's responses here have influenced my mind to see how to get at things more mathematically(he also used to sign everything as '-110' so this reminded me of that, too)
praises to Roman 🙌