I would like to update my scale x this way:
if x is between 1 and 9 so increment by 1
if x is between 10 and 90 so increment by 10 each time
if x is between 100 and 900 so increment by 100 each time, and so on
I thought to implement a case structure and test the variable x, but it will over burden my program
Can anyone help me please
Thank you in advance
My best regards
How would a case structure over burden your application? If that overburdens your application, you have a lot more issues than this. A ranged case structure would be the way to handle your scale problem.
Here is a simple function that converts an integer into an "increment" (so 1-9 returns 1, 10-99 returns 10, etc.). I added a test for 0 and negative numbers, treating them as though they were 1, but you could modify this to better suit your needs.