I'm totally confounded! I keep looking at it but can't understand why "key" would not be a different value each time through the loop.
If I describe how I see the logic perhaps someone could point out my erroneous thinking. Bear with me.
When a key is hit the variable "key" is set to that key.
The "if" statement tests to see that "key" is not an unpressed key nor an "e"
We then serial.print "key" (up to this point everything works fine)
let's say the first key entered is 2
1st loop: i=0, key=2 so value=value2+key=0+2
2nd loop: i=1, key=3, so value=value10+key=20+3=23
3rd loop: i=2, key=4, so value=value*10 +key=23+4=234
I hit "e" and and expect to print 234 but instead I print 11211.
Obviously I don't understand the logic. :-X