Is there a better way of implementing this control structure? I have the following control structure that I would like to improve:

if(number &gt;= 100)    then doSetInc(id, 8, 20)
elseif(number &gt;= 91) then doSetInc(id, 8, 30)
elseif(number &gt;= 81) then doSetInc(id, 8, 50)
elseif(number &gt;= 7)  then doSetInc(id, 8, 70)
elseif(number &gt;= 1)  then doSetInc(id, 8, 100)
end
Kinda hard to know what you mean with better since you don't specify in what regard.

In regards to cleaner code:


FunctionName doSetInc is a bit weird, what does it do?
You are sending in 3 variables into the function, it's common practice to use as few as possible (rarely more than 2, 0 or 1 prefered).
You are always sending in "id" and "8" into the function, thus this function might not need those attributes and could be set in another way.


Other than that, since I find no easy mathematical similarities between these checks and what to do, I would say no, you can't improve it given this small piece of code and no other context.