Hi Jean-Paul - I think the problem is that you are trying to do a mathematical process on a string - leTest is a string and therefore the last char of it will be a string (even though it's a number!). If you were to separate it out, as in "put the last char of leTest into tVar" then tVar could be interpreted separately by the engine as a number - and then you could do maths stuff with it...
But in my example I haven't bothered with that as zzz already holds the number we need...
Code: Select all
on mouseUp
put "2" into tItem
put "0" into les1
put "0" into les2
put "0" into les3
repeat with zzz = 1 to 3 -- just a test
put "les" & zzz into leTest -- build <les2> for example
if zzz = tItem then replace (the last char of leTest) with (zzz + 1) in leTest
end repeat
end mouseUp
EDIT 1: Aha speedy Klaus strikes again

- I got distracted responding to this and got pipped-to-the-post!
EDIT 2: and I see that you were after something different to what I thought you wanted - so Klaus is doubly right and an array should be great for you...